author | eilers <eilers> | 2002-12-16 16:09:51 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-12-16 16:09:51 (UTC) |
commit | c7c8bf3d2fd133fa05ff7a5daed977c05429c4c1 (patch) (unidiff) | |
tree | af2d61766398115557a84a0f9efee6fb684f5e88 | |
parent | cdf781e3243601bce6c7bcbb10f38e7a24f04887 (diff) | |
download | opie-c7c8bf3d2fd133fa05ff7a5daed977c05429c4c1.zip opie-c7c8bf3d2fd133fa05ff7a5daed977c05429c4c1.tar.gz opie-c7c8bf3d2fd133fa05ff7a5daed977c05429c4c1.tar.bz2 |
not important
-rw-r--r-- | core/pim/addressbook/TODO | 2 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index 7e800fa..a9f65de 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO | |||
@@ -1,110 +1,110 @@ | |||
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 incase it's installed and there's no mobile | 9 | - dial with dtmfdial incase 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 | - Plugin for Today for Birthdays and Anniversaries | 13 | - Plugin for Today for Birthdays and Anniversaries |
14 | - Beaming of multiple contacts (current list/ by search or by category) | 14 | - Beaming of multiple contacts (current list/ by search or by category) |
15 | 15 | ||
16 | Known Bugs: | 16 | Known Bugs: |
17 | ----------- | 17 | ----------- |
18 | - Language not English (tested with german opie-translation): | 18 | - Language not English (tested with german opie-translation): |
19 | 1. Configure nicht übersetzt (alles leer). | 19 | 1. Configure nicht übersetzt (alles leer). |
20 | 2. Contacteditor nur teilweise übersetzt. | 20 | 2. Contacteditor nur teilweise übersetzt. |
21 | 3. Kategorie-Picker geht nicht. | 21 | 3. Kategorie-Picker geht nicht. |
22 | 22 | ||
23 | 23 | ||
24 | Bugs but not in addressbook: | 24 | Bugs but not in addressbook: |
25 | ----------------------------- | 25 | ----------------------------- |
26 | - VCARD: If umlaut (äöüß) in address, the parser gets confused.. | 26 | - VCARD: If umlaut (äöüß) in address, the parser gets confused.. |
27 | 27 | ||
28 | - Exporting and reimporting of Jobtitle was reported to fail (Could not reproduce this ! (se)) | 28 | - Exporting and reimporting of Jobtitle was reported to fail (Could not reproduce this ! (se)) |
29 | 29 | ||
30 | 30 | ||
31 | Urgent: | 31 | Urgent: |
32 | -------- | 32 | -------- |
33 | - Implement Button Pics | 33 | - Implement Button Pics |
34 | - Fix start of opie-mail | ||
35 | 34 | ||
36 | ContactEditor: | 35 | ContactEditor: |
37 | - Contact-Editor is temporarely reenabled. Wait for replacement. | 36 | - Contact-Editor is temporarely reenabled. Wait for replacement. |
38 | - Redesign of Contacteditor | 37 | - Redesign of Contacteditor |
39 | - Store last settings of combo-boxes | 38 | - Store last settings of combo-boxes |
40 | - Category is on the wrong position after changing to personal and back to normal | 39 | - Category is on the wrong position after changing to personal and back to normal |
41 | ( Temporarily workaround: Category is never deactivated.. :S ) | 40 | ( Temporarily workaround: Category is never deactivated.. :S ) |
42 | - Personal and Business Web-page is not editable | 41 | - Personal and Business Web-page is not editable |
43 | 42 | ||
44 | Important: | 43 | Important: |
45 | ---------- | 44 | ---------- |
46 | 45 | ||
47 | - Implement a picker/combo for the default email. | 46 | - Implement a picker/combo for the default email. |
48 | - After search (Started with Return): KeyFocus should be on Tabelle | 47 | - After search (Started with Return): KeyFocus should be on Tabelle |
49 | 48 | ||
50 | - Add a dialog to accept and optionally edit received contacts by IRDA. | 49 | - Add a dialog to accept and optionally edit received contacts by IRDA. |
51 | - "What's this" should be added (Deleyed after Feature Freeze) | 50 | - "What's this" should be added (Deleyed after Feature Freeze) |
52 | 51 | ||
53 | Less important: | 52 | Less important: |
54 | --------------- | 53 | --------------- |
55 | - Reload if contacts were changed externally | 54 | - Reload if contacts were changed externally |
56 | - Overview window cleanup needed.. | 55 | - Overview window cleanup needed.. |
57 | - The picker (alphabetical sort widget) should be | 56 | - The picker (alphabetical sort widget) should be |
58 | placed verticaly or horizontally (configurable) | 57 | placed verticaly or horizontally (configurable) |
59 | - Find a smart solution for activating/deactivating the "send email" event | 58 | - Find a smart solution for activating/deactivating the "send email" event |
60 | 59 | ||
61 | Should be Fixed (not absolute sure, need further validation): | 60 | Should be Fixed (not absolute sure, need further validation): |
62 | ------------------------------------------------------------- | 61 | ------------------------------------------------------------- |
63 | 62 | ||
64 | 63 | ||
65 | Fixed: | 64 | Fixed: |
66 | ------- | 65 | ------- |
67 | - Syncing: abtable not reloaded after sync. | 66 | - Syncing: abtable not reloaded after sync. |
68 | - Find widget should be replaced by something like | 67 | - Find widget should be replaced by something like |
69 | qpdf has. | 68 | qpdf has. |
70 | - Adding a configuration dialog | 69 | - Adding a configuration dialog |
71 | - Picker: Activated letter schould be more visible | 70 | - Picker: Activated letter schould be more visible |
72 | - Advanced handling of cursor keys (search..) | 71 | - Advanced handling of cursor keys (search..) |
73 | - Mail-Icon is missing | 72 | - Mail-Icon is missing |
74 | - Use opie-mail insted of qt-mail if possible. | 73 | - Use opie-mail insted of qt-mail if possible. |
75 | - Font menu is invisible using german translation | 74 | - Font menu is invisible using german translation |
76 | - Personal contact editor: Disable categories | 75 | - Personal contact editor: Disable categories |
77 | - "Nonenglish" translation bug has to be fixed. | 76 | - "Nonenglish" translation bug has to be fixed. |
78 | - contacteditor: Birthday, annyversary, ... : Use Dateselector | 77 | - contacteditor: Birthday, annyversary, ... : Use Dateselector |
79 | - The names of the countries are sorted by there english names, only.. | 78 | - The names of the countries are sorted by there english names, only.. |
80 | Even if they are translated.. :S | 79 | Even if they are translated.. :S |
81 | - Cursor keys should work in detail-view (ablabel) | 80 | - Cursor keys should work in detail-view (ablabel) |
82 | -> Ablabel should be removed and Abtable should be increased with | 81 | -> Ablabel should be removed and Abtable should be increased with |
83 | different views (as started by darwin zins).. | 82 | different views (as started by darwin zins).. |
84 | - Use advanced database functions in abtable to decrease | 83 | - Use advanced database functions in abtable to decrease |
85 | memory footprint and to make everything more easy ! | 84 | memory footprint and to make everything more easy ! |
86 | (abtable should store Iterator for selected Category) | 85 | (abtable should store Iterator for selected Category) |
87 | - Abtable: Configure Contact column (internally already available, | 86 | - Abtable: Configure Contact column (internally already available, |
88 | need configuration) | 87 | need configuration) |
89 | - Select of primary contact (see #274 on mantis) | 88 | - Select of primary contact (see #274 on mantis) |
90 | - Category-select does not work completely: "Unfiled" is always in listview .. | 89 | - Category-select does not work completely: "Unfiled" is always in listview .. |
91 | - Return from Contacteditor: Category resettet to all | 90 | - Return from Contacteditor: Category resettet to all |
92 | - Personal Details not working | 91 | - Personal Details not working |
93 | - If category changed, the letterpicker should be resetted | 92 | - If category changed, the letterpicker should be resetted |
94 | - There should be some icons for List and Cardview | 93 | - There should be some icons for List and Cardview |
95 | - If in Cardview and a category change removes all entries: | 94 | - If in Cardview and a category change removes all entries: |
96 | There are already entries in Cardview after up/down | 95 | There are already entries in Cardview after up/down |
97 | - Personal Details: Anniversary zeigt Fantasie-Werte | 96 | - Personal Details: Anniversary zeigt Fantasie-Werte |
98 | - Unfiled shown just in Category "All" and "Unfiled". | 97 | - Unfiled shown just in Category "All" and "Unfiled". |
99 | - After finising search and after Edit: Clear Picker | 98 | - After finising search and after Edit: Clear Picker |
100 | - After Edit: Table position back to edited entry. | 99 | - After Edit: Table position back to edited entry. |
101 | - Optimize Table Update... | 100 | - Optimize Table Update... |
102 | - Change MyDialog to Config | 101 | - Change MyDialog to Config |
103 | - Store position and state of toolbar | 102 | - Store position and state of toolbar |
104 | - Searchwidget closed: Selected user is jumping | 103 | - Searchwidget closed: Selected user is jumping |
105 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) | 104 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) |
106 | zu lange.. | 105 | zu lange.. |
107 | - VCARD: Import of Anniversary does not work correctly (currently disabled) | 106 | - VCARD: Import of Anniversary does not work correctly (currently disabled) |
108 | - Name order selected in "contacteditor" not used in list view. | 107 | - Name order selected in "contacteditor" not used in list view. |
109 | - OK-Key does not switch from Detailview (ablable) to Listview | 108 | - OK-Key does not switch from Detailview (ablable) to Listview |
110 | - Receiving of beams should open a dialog | 109 | - Receiving of beams should open a dialog |
110 | - Fix start of opie-mail | ||
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 12dc24e..68fcf1e 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -1,917 +1,917 @@ | |||
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( true ); | 90 | setToolBarsMovable( true ); |
91 | setRightJustification( true ); | 91 | setRightJustification( true ); |
92 | 92 | ||
93 | // Create Toolbar | 93 | // Create Toolbar |
94 | listTools = new QPEToolBar( this, "list operations" ); | 94 | listTools = new QPEToolBar( this, "list operations" ); |
95 | listTools->setHorizontalStretchable( true ); | 95 | listTools->setHorizontalStretchable( true ); |
96 | addToolBar( listTools ); | 96 | addToolBar( listTools ); |
97 | moveToolBar( listTools, m_config.getToolBarPos() ); | 97 | moveToolBar( listTools, m_config.getToolBarPos() ); |
98 | 98 | ||
99 | QPEMenuBar *mbList = new QPEMenuBar( this ); | 99 | QPEMenuBar *mbList = new QPEMenuBar( this ); |
100 | mbList->setMargin( 0 ); | 100 | mbList->setMargin( 0 ); |
101 | 101 | ||
102 | QPopupMenu *edit = new QPopupMenu( mbList ); | 102 | QPopupMenu *edit = new QPopupMenu( mbList ); |
103 | mbList->insertItem( tr( "Contact" ), edit ); | 103 | mbList->insertItem( tr( "Contact" ), edit ); |
104 | 104 | ||
105 | 105 | ||
106 | // View Icons | 106 | // View Icons |
107 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "datebook/weeklst" ), | 107 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "datebook/weeklst" ), |
108 | QString::null, 0, this, 0 ); | 108 | QString::null, 0, this, 0 ); |
109 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); | 109 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); |
110 | m_tableViewButton->setToggleAction( true ); | 110 | m_tableViewButton->setToggleAction( true ); |
111 | m_tableViewButton->addTo( listTools ); | 111 | m_tableViewButton->addTo( listTools ); |
112 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 ); | 112 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 ); |
113 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); | 113 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); |
114 | m_cardViewButton->setToggleAction( true ); | 114 | m_cardViewButton->setToggleAction( true ); |
115 | m_cardViewButton->addTo( listTools ); | 115 | m_cardViewButton->addTo( listTools ); |
116 | 116 | ||
117 | listTools->addSeparator(); | 117 | listTools->addSeparator(); |
118 | 118 | ||
119 | // Other Buttons | 119 | // Other Buttons |
120 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, | 120 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, |
121 | 0, this, 0 ); | 121 | 0, this, 0 ); |
122 | actionNew = a; | 122 | actionNew = a; |
123 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); | 123 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); |
124 | a->addTo( edit ); | 124 | a->addTo( edit ); |
125 | a->addTo( listTools ); | 125 | a->addTo( listTools ); |
126 | 126 | ||
127 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | 127 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, |
128 | 0, this, 0 ); | 128 | 0, this, 0 ); |
129 | actionEdit = a; | 129 | actionEdit = a; |
130 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); | 130 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); |
131 | a->addTo( edit ); | 131 | a->addTo( edit ); |
132 | a->addTo( listTools ); | 132 | a->addTo( listTools ); |
133 | 133 | ||
134 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 134 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
135 | 0, this, 0 ); | 135 | 0, this, 0 ); |
136 | actionTrash = a; | 136 | actionTrash = a; |
137 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); | 137 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); |
138 | a->addTo( edit ); | 138 | a->addTo( edit ); |
139 | a->addTo( listTools ); | 139 | a->addTo( listTools ); |
140 | 140 | ||
141 | 141 | ||
142 | // make it possible to go directly to businesscard via qcop call | 142 | // make it possible to go directly to businesscard via qcop call |
143 | #if defined(Q_WS_QWS) | 143 | //#if defined(Q_WS_QWS) // Why this ? (se) |
144 | #if !defined(QT_NO_COP) | 144 | #if !defined(QT_NO_COP) |
145 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); | 145 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); |
146 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), | 146 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), |
147 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); | 147 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); |
148 | #endif | 148 | #endif |
149 | #endif | 149 | // #endif |
150 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), | 150 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), |
151 | QString::null, 0, this, 0 ); | 151 | QString::null, 0, this, 0 ); |
152 | actionFind = a; | 152 | actionFind = a; |
153 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); | 153 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); |
154 | a->addTo( edit ); | 154 | a->addTo( edit ); |
155 | a->addTo( listTools ); | 155 | a->addTo( listTools ); |
156 | 156 | ||
157 | // Much better search widget, taken from QTReader.. (se) | 157 | // Much better search widget, taken from QTReader.. (se) |
158 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); | 158 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); |
159 | searchBar->setHorizontalStretchable( TRUE ); | 159 | searchBar->setHorizontalStretchable( TRUE ); |
160 | searchBar->hide(); | 160 | searchBar->hide(); |
161 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 161 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
162 | 162 | ||
163 | // QFont f("unifont", 16 /*, QFont::Bold*/); | 163 | // QFont f("unifont", 16 /*, QFont::Bold*/); |
164 | // searchEdit->setFont( f ); | 164 | // searchEdit->setFont( f ); |
165 | 165 | ||
166 | searchBar->setStretchableWidget( searchEdit ); | 166 | searchBar->setStretchableWidget( searchEdit ); |
167 | connect( searchEdit, SIGNAL( returnPressed( ) ), | 167 | connect( searchEdit, SIGNAL( returnPressed( ) ), |
168 | this, SLOT( slotFind( ) ) ); | 168 | this, SLOT( slotFind( ) ) ); |
169 | 169 | ||
170 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | 170 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); |
171 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | 171 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); |
172 | a->addTo( searchBar ); | 172 | a->addTo( searchBar ); |
173 | 173 | ||
174 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 174 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
175 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); | 175 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); |
176 | a->addTo( searchBar ); | 176 | a->addTo( searchBar ); |
177 | 177 | ||
178 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "mail/sendmail" ), | 178 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "mail/sendmail" ), |
179 | QString::null, 0, this, 0 ); | 179 | QString::null, 0, this, 0 ); |
180 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 180 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
181 | actionMail = a; | 181 | actionMail = a; |
182 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 182 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
183 | a->addTo( edit ); | 183 | a->addTo( edit ); |
184 | a->addTo( listTools ); | 184 | a->addTo( listTools ); |
185 | 185 | ||
186 | if ( Ir::supported() ) { | 186 | if ( Ir::supported() ) { |
187 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | 187 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, |
188 | 0, this, 0 ); | 188 | 0, this, 0 ); |
189 | actionBeam = a; | 189 | actionBeam = a; |
190 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 190 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
191 | a->addTo( edit ); | 191 | a->addTo( edit ); |
192 | a->addTo( listTools ); | 192 | a->addTo( listTools ); |
193 | } | 193 | } |
194 | 194 | ||
195 | edit->insertSeparator(); | 195 | edit->insertSeparator(); |
196 | 196 | ||
197 | a = new QAction( tr("Import vCard"), QString::null, 0, 0); | 197 | a = new QAction( tr("Import vCard"), QString::null, 0, 0); |
198 | actionPersonal = a; | 198 | actionPersonal = a; |
199 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); | 199 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); |
200 | a->addTo( edit ); | 200 | a->addTo( edit ); |
201 | 201 | ||
202 | edit->insertSeparator(); | 202 | edit->insertSeparator(); |
203 | 203 | ||
204 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); | 204 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); |
205 | actionPersonal = a; | 205 | actionPersonal = a; |
206 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); | 206 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); |
207 | a->addTo( edit ); | 207 | a->addTo( edit ); |
208 | 208 | ||
209 | 209 | ||
210 | #ifdef __DEBUG_RELEASE | 210 | #ifdef __DEBUG_RELEASE |
211 | // Remove this function for public Release ! This is only | 211 | // Remove this function for public Release ! This is only |
212 | // for debug purposes .. | 212 | // for debug purposes .. |
213 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); | 213 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); |
214 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); | 214 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); |
215 | a->addTo( edit ); | 215 | a->addTo( edit ); |
216 | #endif | 216 | #endif |
217 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, | 217 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, |
218 | 0, this, 0 ); | 218 | 0, this, 0 ); |
219 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); | 219 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); |
220 | a->addTo( edit ); | 220 | a->addTo( edit ); |
221 | 221 | ||
222 | // Create Views | 222 | // Create Views |
223 | listContainer = new QWidget( this ); | 223 | listContainer = new QWidget( this ); |
224 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | 224 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); |
225 | 225 | ||
226 | m_abView = new AbView( listContainer, m_config.orderList() ); | 226 | m_abView = new AbView( listContainer, m_config.orderList() ); |
227 | vb->addWidget( m_abView ); | 227 | vb->addWidget( m_abView ); |
228 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 228 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
229 | connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), | 229 | connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), |
230 | this, SLOT( slotViewSwitched( int ) ) ); | 230 | this, SLOT( slotViewSwitched( int ) ) ); |
231 | 231 | ||
232 | 232 | ||
233 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); | 233 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); |
234 | 234 | ||
235 | m_abView->load(); | 235 | m_abView->load(); |
236 | 236 | ||
237 | // Letter Picker | 237 | // Letter Picker |
238 | pLabel = new LetterPicker( listContainer ); | 238 | pLabel = new LetterPicker( listContainer ); |
239 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 239 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
240 | connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); | 240 | connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); |
241 | 241 | ||
242 | vb->addWidget( pLabel ); | 242 | vb->addWidget( pLabel ); |
243 | 243 | ||
244 | // Category Menu | 244 | // Category Menu |
245 | catMenu = new QPopupMenu( this ); | 245 | catMenu = new QPopupMenu( this ); |
246 | catMenu->setCheckable( TRUE ); | 246 | catMenu->setCheckable( TRUE ); |
247 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 247 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
248 | populateCategories(); | 248 | populateCategories(); |
249 | mbList->insertItem( tr("View"), catMenu ); | 249 | mbList->insertItem( tr("View"), catMenu ); |
250 | 250 | ||
251 | defaultFont = new QFont( m_abView->font() ); | 251 | defaultFont = new QFont( m_abView->font() ); |
252 | slotSetFont(m_config.fontSize()); | 252 | slotSetFont(m_config.fontSize()); |
253 | m_curFontSize = m_config.fontSize(); | 253 | m_curFontSize = m_config.fontSize(); |
254 | 254 | ||
255 | setCentralWidget(listContainer); | 255 | setCentralWidget(listContainer); |
256 | 256 | ||
257 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 257 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
258 | 258 | ||
259 | 259 | ||
260 | isLoading = false; | 260 | isLoading = false; |
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
264 | void AddressbookWindow::slotConfig() | 264 | void AddressbookWindow::slotConfig() |
265 | { | 265 | { |
266 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); | 266 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); |
267 | dlg -> setConfig( m_config ); | 267 | dlg -> setConfig( m_config ); |
268 | dlg -> showMaximized(); | 268 | dlg -> showMaximized(); |
269 | if ( dlg -> exec() ) { | 269 | if ( dlg -> exec() ) { |
270 | qWarning ("Config Dialog accepted!"); | 270 | qWarning ("Config Dialog accepted!"); |
271 | m_config = dlg -> getConfig(); | 271 | m_config = dlg -> getConfig(); |
272 | if ( m_curFontSize != m_config.fontSize() ){ | 272 | if ( m_curFontSize != m_config.fontSize() ){ |
273 | qWarning("Font was changed!"); | 273 | qWarning("Font was changed!"); |
274 | m_curFontSize = m_config.fontSize(); | 274 | m_curFontSize = m_config.fontSize(); |
275 | emit slotSetFont( m_curFontSize ); | 275 | emit slotSetFont( m_curFontSize ); |
276 | } | 276 | } |
277 | m_abView -> setListOrder( m_config.orderList() ); | 277 | m_abView -> setListOrder( m_config.orderList() ); |
278 | } | 278 | } |
279 | 279 | ||
280 | delete dlg; | 280 | delete dlg; |
281 | } | 281 | } |
282 | 282 | ||
283 | 283 | ||
284 | void AddressbookWindow::slotSetFont( int size ) | 284 | void AddressbookWindow::slotSetFont( int size ) |
285 | { | 285 | { |
286 | qWarning("void AddressbookWindow::slotSetFont( %d )", size); | 286 | qWarning("void AddressbookWindow::slotSetFont( %d )", size); |
287 | 287 | ||
288 | if (size > 2 || size < 0) | 288 | if (size > 2 || size < 0) |
289 | size = 1; | 289 | size = 1; |
290 | 290 | ||
291 | m_config.setFontSize( size ); | 291 | m_config.setFontSize( size ); |
292 | 292 | ||
293 | QFont *currentFont; | 293 | QFont *currentFont; |
294 | 294 | ||
295 | switch (size) { | 295 | switch (size) { |
296 | case 0: | 296 | case 0: |
297 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); | 297 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); |
298 | currentFont = new QFont (m_abView->font()); | 298 | currentFont = new QFont (m_abView->font()); |
299 | // abList->resizeRows(currentFont->pixelSize() + 7); :SX | 299 | // abList->resizeRows(currentFont->pixelSize() + 7); :SX |
300 | // abList->resizeRows(); | 300 | // abList->resizeRows(); |
301 | break; | 301 | break; |
302 | case 1: | 302 | case 1: |
303 | m_abView->setFont( *defaultFont ); | 303 | m_abView->setFont( *defaultFont ); |
304 | currentFont = new QFont (m_abView->font()); | 304 | currentFont = new QFont (m_abView->font()); |
305 | // // abList->resizeRows(currentFont->pixelSize() + 7); | 305 | // // abList->resizeRows(currentFont->pixelSize() + 7); |
306 | // abList->resizeRows(); | 306 | // abList->resizeRows(); |
307 | break; | 307 | break; |
308 | case 2: | 308 | case 2: |
309 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); | 309 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); |
310 | currentFont = new QFont (m_abView->font()); | 310 | currentFont = new QFont (m_abView->font()); |
311 | // //abList->resizeRows(currentFont->pixelSize() + 7); | 311 | // //abList->resizeRows(currentFont->pixelSize() + 7); |
312 | // abList->resizeRows(); | 312 | // abList->resizeRows(); |
313 | break; | 313 | break; |
314 | } | 314 | } |
315 | } | 315 | } |
316 | 316 | ||
317 | 317 | ||
318 | 318 | ||
319 | void AddressbookWindow::importvCard() { | 319 | void AddressbookWindow::importvCard() { |
320 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); | 320 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); |
321 | if(!str.isEmpty() ){ | 321 | if(!str.isEmpty() ){ |
322 | setDocument((const QString&) str ); | 322 | setDocument((const QString&) str ); |
323 | } | 323 | } |
324 | 324 | ||
325 | } | 325 | } |
326 | 326 | ||
327 | void AddressbookWindow::setDocument( const QString &filename ) | 327 | void AddressbookWindow::setDocument( const QString &filename ) |
328 | { | 328 | { |
329 | qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); | 329 | qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); |
330 | 330 | ||
331 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ | 331 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ |
332 | 332 | ||
333 | 333 | ||
334 | 334 | ||
335 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), | 335 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), |
336 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), | 336 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), |
337 | tr( "&Yes" ), tr( "&No" ), QString::null, | 337 | tr( "&Yes" ), tr( "&No" ), QString::null, |
338 | 0, // Enter == button 0 | 338 | 0, // Enter == button 0 |
339 | 2 ) ) { // Escape == button 2 | 339 | 2 ) ) { // Escape == button 2 |
340 | case 0: | 340 | case 0: |
341 | qWarning("YES clicked"); | 341 | qWarning("YES clicked"); |
342 | break; | 342 | break; |
343 | case 1: | 343 | case 1: |
344 | qWarning("NO clicked"); | 344 | qWarning("NO clicked"); |
345 | return; | 345 | return; |
346 | break; | 346 | break; |
347 | } | 347 | } |
348 | } | 348 | } |
349 | 349 | ||
350 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 350 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
351 | filename ); | 351 | filename ); |
352 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 352 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
353 | OContactAccess::List allList = access->allRecords(); | 353 | OContactAccess::List allList = access->allRecords(); |
354 | qWarning( "Found number of contacts in File: %d", allList.count() ); | 354 | qWarning( "Found number of contacts in File: %d", allList.count() ); |
355 | 355 | ||
356 | if ( !allList.count() ) { | 356 | if ( !allList.count() ) { |
357 | QMessageBox::information( this, "Import VCard", | 357 | QMessageBox::information( this, "Import VCard", |
358 | "It was impossible to import the VCard.\n" | 358 | "It was impossible to import the VCard.\n" |
359 | "The VCard may be corrupted!" ); | 359 | "The VCard may be corrupted!" ); |
360 | } | 360 | } |
361 | 361 | ||
362 | bool doAsk = true; | 362 | bool doAsk = true; |
363 | OContactAccess::List::Iterator it; | 363 | OContactAccess::List::Iterator it; |
364 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 364 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
365 | qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); | 365 | qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); |
366 | if ( doAsk ){ | 366 | if ( doAsk ){ |
367 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), | 367 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), |
368 | tr( "Do you really want add contact for \n%1?" ) | 368 | tr( "Do you really want add contact for \n%1?" ) |
369 | .arg( (*it).fullName().latin1() ), | 369 | .arg( (*it).fullName().latin1() ), |
370 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), | 370 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), |
371 | 0, // Enter == button 0 | 371 | 0, // Enter == button 0 |
372 | 2 ) ) { // Escape == button 2 | 372 | 2 ) ) { // Escape == button 2 |
373 | case 0: | 373 | case 0: |
374 | qWarning("YES clicked"); | 374 | qWarning("YES clicked"); |
375 | m_abView->addEntry( *it ); | 375 | m_abView->addEntry( *it ); |
376 | break; | 376 | break; |
377 | case 1: | 377 | case 1: |
378 | qWarning("NO clicked"); | 378 | qWarning("NO clicked"); |
379 | break; | 379 | break; |
380 | case 2: | 380 | case 2: |
381 | qWarning("YesAll clicked"); | 381 | qWarning("YesAll clicked"); |
382 | doAsk = false; | 382 | doAsk = false; |
383 | break; | 383 | break; |
384 | } | 384 | } |
385 | }else | 385 | }else |
386 | m_abView->addEntry( *it ); | 386 | m_abView->addEntry( *it ); |
387 | 387 | ||
388 | } | 388 | } |
389 | 389 | ||
390 | delete access; | 390 | delete access; |
391 | } | 391 | } |
392 | 392 | ||
393 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 393 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
394 | { | 394 | { |
395 | QMainWindow::resizeEvent( e ); | 395 | QMainWindow::resizeEvent( e ); |
396 | 396 | ||
397 | 397 | ||
398 | } | 398 | } |
399 | 399 | ||
400 | AddressbookWindow::~AddressbookWindow() | 400 | AddressbookWindow::~AddressbookWindow() |
401 | { | 401 | { |
402 | ToolBarDock dock; | 402 | ToolBarDock dock; |
403 | int dummy; | 403 | int dummy; |
404 | bool bDummy; | 404 | bool bDummy; |
405 | getLocation ( listTools, dock, dummy, bDummy, dummy ); | 405 | getLocation ( listTools, dock, dummy, bDummy, dummy ); |
406 | m_config.setToolBarDock( dock ); | 406 | m_config.setToolBarDock( dock ); |
407 | m_config.save(); | 407 | m_config.save(); |
408 | } | 408 | } |
409 | 409 | ||
410 | void AddressbookWindow::slotUpdateToolbar() | 410 | void AddressbookWindow::slotUpdateToolbar() |
411 | { | 411 | { |
412 | OContact ce = m_abView->currentEntry(); | 412 | OContact ce = m_abView->currentEntry(); |
413 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 413 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
414 | } | 414 | } |
415 | 415 | ||
416 | void AddressbookWindow::slotListNew() | 416 | void AddressbookWindow::slotListNew() |
417 | { | 417 | { |
418 | OContact cnt; | 418 | OContact cnt; |
419 | if( !syncing ) { | 419 | if( !syncing ) { |
420 | editEntry( NewEntry ); | 420 | editEntry( NewEntry ); |
421 | } else { | 421 | } else { |
422 | QMessageBox::warning(this, tr("OContacts"), | 422 | QMessageBox::warning(this, tr("OContacts"), |
423 | tr("Can not edit data, currently syncing")); | 423 | tr("Can not edit data, currently syncing")); |
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
427 | // void AddressbookWindow::slotListView() | 427 | // void AddressbookWindow::slotListView() |
428 | // { | 428 | // { |
429 | // m_abView -> init( abList->currentEntry() ); | 429 | // m_abView -> init( abList->currentEntry() ); |
430 | // // :SX mView->sync(); | 430 | // // :SX mView->sync(); |
431 | // //:SXshowView(); | 431 | // //:SXshowView(); |
432 | // } | 432 | // } |
433 | 433 | ||
434 | void AddressbookWindow::slotListDelete() | 434 | void AddressbookWindow::slotListDelete() |
435 | { | 435 | { |
436 | if(!syncing) { | 436 | if(!syncing) { |
437 | OContact tmpEntry = m_abView ->currentEntry(); | 437 | OContact tmpEntry = m_abView ->currentEntry(); |
438 | 438 | ||
439 | // get a name, do the best we can... | 439 | // get a name, do the best we can... |
440 | QString strName = tmpEntry.fullName(); | 440 | QString strName = tmpEntry.fullName(); |
441 | if ( strName.isEmpty() ) { | 441 | if ( strName.isEmpty() ) { |
442 | strName = tmpEntry.company(); | 442 | strName = tmpEntry.company(); |
443 | if ( strName.isEmpty() ) | 443 | if ( strName.isEmpty() ) |
444 | strName = "No Name"; | 444 | strName = "No Name"; |
445 | } | 445 | } |
446 | 446 | ||
447 | 447 | ||
448 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), | 448 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), |
449 | strName ) ) { | 449 | strName ) ) { |
450 | m_abView->removeEntry( tmpEntry.uid() ); | 450 | m_abView->removeEntry( tmpEntry.uid() ); |
451 | } | 451 | } |
452 | } else { | 452 | } else { |
453 | QMessageBox::warning( this, tr("Contacts"), | 453 | QMessageBox::warning( this, tr("Contacts"), |
454 | tr("Can not edit data, currently syncing") ); | 454 | tr("Can not edit data, currently syncing") ); |
455 | } | 455 | } |
456 | } | 456 | } |
457 | 457 | ||
458 | void AddressbookWindow::slotFindOpen() | 458 | void AddressbookWindow::slotFindOpen() |
459 | { | 459 | { |
460 | searchBar->show(); | 460 | searchBar->show(); |
461 | m_abView -> inSearch(); | 461 | m_abView -> inSearch(); |
462 | searchEdit->setFocus(); | 462 | searchEdit->setFocus(); |
463 | } | 463 | } |
464 | void AddressbookWindow::slotFindClose() | 464 | void AddressbookWindow::slotFindClose() |
465 | { | 465 | { |
466 | searchBar->hide(); | 466 | searchBar->hide(); |
467 | m_abView -> offSearch(); | 467 | m_abView -> offSearch(); |
468 | // m_abView->setFocus(); | 468 | // m_abView->setFocus(); |
469 | } | 469 | } |
470 | 470 | ||
471 | 471 | ||
472 | void AddressbookWindow::slotFind() | 472 | void AddressbookWindow::slotFind() |
473 | { | 473 | { |
474 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); | 474 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); |
475 | 475 | ||
476 | searchEdit->clearFocus(); | 476 | searchEdit->clearFocus(); |
477 | // m_abView->setFocus(); | 477 | // m_abView->setFocus(); |
478 | 478 | ||
479 | } | 479 | } |
480 | 480 | ||
481 | void AddressbookWindow::slotViewBack() | 481 | void AddressbookWindow::slotViewBack() |
482 | { | 482 | { |
483 | // :SX showList(); | 483 | // :SX showList(); |
484 | } | 484 | } |
485 | 485 | ||
486 | void AddressbookWindow::slotViewEdit() | 486 | void AddressbookWindow::slotViewEdit() |
487 | { | 487 | { |
488 | if(!syncing) { | 488 | if(!syncing) { |
489 | if (actionPersonal->isOn()) { | 489 | if (actionPersonal->isOn()) { |
490 | editPersonal(); | 490 | editPersonal(); |
491 | } else { | 491 | } else { |
492 | editEntry( EditEntry ); | 492 | editEntry( EditEntry ); |
493 | } | 493 | } |
494 | } else { | 494 | } else { |
495 | QMessageBox::warning( this, tr("Contacts"), | 495 | QMessageBox::warning( this, tr("Contacts"), |
496 | tr("Can not edit data, currently syncing") ); | 496 | tr("Can not edit data, currently syncing") ); |
497 | } | 497 | } |
498 | } | 498 | } |
499 | 499 | ||
500 | 500 | ||
501 | 501 | ||
502 | void AddressbookWindow::writeMail() | 502 | void AddressbookWindow::writeMail() |
503 | { | 503 | { |
504 | OContact c = m_abView -> currentEntry(); | 504 | OContact c = m_abView -> currentEntry(); |
505 | QString name = c.fileAs(); | 505 | QString name = c.fileAs(); |
506 | QString email = c.defaultEmail(); | 506 | QString email = c.defaultEmail(); |
507 | 507 | ||
508 | // I prefer the OPIE-Environment variable before the | 508 | // I prefer the OPIE-Environment variable before the |
509 | // QPE-one.. | 509 | // QPE-one.. |
510 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); | 510 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); |
511 | if ( basepath.isEmpty() ) | 511 | if ( basepath.isEmpty() ) |
512 | basepath = QString::fromLatin1( getenv("QPEDIR") ); | 512 | basepath = QString::fromLatin1( getenv("QPEDIR") ); |
513 | 513 | ||
514 | // Try to access the preferred. If not possible, try to | 514 | // Try to access the preferred. If not possible, try to |
515 | // switch to the other one.. | 515 | // switch to the other one.. |
516 | if ( m_config.useQtMail() ){ | 516 | if ( m_config.useQtMail() ){ |
517 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); | 517 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); |
518 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ | 518 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ |
519 | qWarning ("QCop"); | 519 | qWarning ("QCop"); |
520 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 520 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); |
521 | e << name << email; | 521 | e << name << email; |
522 | return; | 522 | return; |
523 | } else | 523 | } else |
524 | m_config.setUseOpieMail( true ); | 524 | m_config.setUseOpieMail( true ); |
525 | } | 525 | } |
526 | if ( m_config.useOpieMail() ){ | 526 | if ( m_config.useOpieMail() ){ |
527 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); | 527 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); |
528 | if ( QFile::exists( basepath + "/bin/mail" ) ){ | 528 | if ( QFile::exists( basepath + "/bin/mail" ) ){ |
529 | qWarning ("QCop"); | 529 | qWarning ("QCop"); |
530 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); | 530 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); |
531 | e << name << email; | 531 | e << name << email; |
532 | return; | 532 | return; |
533 | } else | 533 | } else |
534 | m_config.setUseQtMail( true ); | 534 | m_config.setUseQtMail( true ); |
535 | } | 535 | } |
536 | 536 | ||
537 | } | 537 | } |
538 | 538 | ||
539 | static const char * beamfile = "/tmp/obex/contact.vcf"; | 539 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
540 | 540 | ||
541 | void AddressbookWindow::slotBeam() | 541 | void AddressbookWindow::slotBeam() |
542 | { | 542 | { |
543 | QString filename; | 543 | QString filename; |
544 | OContact c; | 544 | OContact c; |
545 | if ( actionPersonal->isOn() ) { | 545 | if ( actionPersonal->isOn() ) { |
546 | filename = addressbookPersonalVCardName(); | 546 | filename = addressbookPersonalVCardName(); |
547 | if (!QFile::exists(filename)) | 547 | if (!QFile::exists(filename)) |
548 | return; // can't beam a non-existent file | 548 | return; // can't beam a non-existent file |
549 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 549 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
550 | filename ); | 550 | filename ); |
551 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 551 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
552 | OContactAccess::List allList = access->allRecords(); | 552 | OContactAccess::List allList = access->allRecords(); |
553 | OContactAccess::List::Iterator it = allList.begin(); // Just take first | 553 | OContactAccess::List::Iterator it = allList.begin(); // Just take first |
554 | c = *it; | 554 | c = *it; |
555 | 555 | ||
556 | delete access; | 556 | delete access; |
557 | } else { | 557 | } else { |
558 | unlink( beamfile ); // delete if exists | 558 | unlink( beamfile ); // delete if exists |
559 | mkdir("/tmp/obex/", 0755); | 559 | mkdir("/tmp/obex/", 0755); |
560 | c = m_abView -> currentEntry(); | 560 | c = m_abView -> currentEntry(); |
561 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 561 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
562 | beamfile ); | 562 | beamfile ); |
563 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 563 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
564 | access->add( c ); | 564 | access->add( c ); |
565 | access->save(); | 565 | access->save(); |
566 | delete access; | 566 | delete access; |
567 | 567 | ||
568 | filename = beamfile; | 568 | filename = beamfile; |
569 | } | 569 | } |
570 | 570 | ||
571 | 571 | ||
572 | Ir *ir = new Ir( this ); | 572 | Ir *ir = new Ir( this ); |
573 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 573 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
574 | QString description = c.fullName(); | 574 | QString description = c.fullName(); |
575 | ir->send( filename, description, "text/x-vCard" ); | 575 | ir->send( filename, description, "text/x-vCard" ); |
576 | } | 576 | } |
577 | 577 | ||
578 | void AddressbookWindow::beamDone( Ir *ir ) | 578 | void AddressbookWindow::beamDone( Ir *ir ) |
579 | { | 579 | { |
580 | delete ir; | 580 | delete ir; |
581 | unlink( beamfile ); | 581 | unlink( beamfile ); |
582 | } | 582 | } |
583 | 583 | ||
584 | 584 | ||
585 | static void parseName( const QString& name, QString *first, QString *middle, | 585 | static void parseName( const QString& name, QString *first, QString *middle, |
586 | QString * last ) | 586 | QString * last ) |
587 | { | 587 | { |
588 | 588 | ||
589 | int comma = name.find ( "," ); | 589 | int comma = name.find ( "," ); |
590 | QString rest; | 590 | QString rest; |
591 | if ( comma > 0 ) { | 591 | if ( comma > 0 ) { |
592 | *last = name.left( comma ); | 592 | *last = name.left( comma ); |
593 | comma++; | 593 | comma++; |
594 | while ( comma < int(name.length()) && name[comma] == ' ' ) | 594 | while ( comma < int(name.length()) && name[comma] == ' ' ) |
595 | comma++; | 595 | comma++; |
596 | rest = name.mid( comma ); | 596 | rest = name.mid( comma ); |
597 | } else { | 597 | } else { |
598 | int space = name.findRev( ' ' ); | 598 | int space = name.findRev( ' ' ); |
599 | *last = name.mid( space+1 ); | 599 | *last = name.mid( space+1 ); |
600 | rest = name.left( space ); | 600 | rest = name.left( space ); |
601 | } | 601 | } |
602 | int space = rest.find( ' ' ); | 602 | int space = rest.find( ' ' ); |
603 | if ( space <= 0 ) { | 603 | if ( space <= 0 ) { |
604 | *first = rest; | 604 | *first = rest; |
605 | } else { | 605 | } else { |
606 | *first = rest.left( space ); | 606 | *first = rest.left( space ); |
607 | *middle = rest.mid( space+1 ); | 607 | *middle = rest.mid( space+1 ); |
608 | } | 608 | } |
609 | 609 | ||
610 | } | 610 | } |
611 | 611 | ||
612 | 612 | ||
613 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 613 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
614 | { | 614 | { |
615 | if (msg == "editPersonal()") { | 615 | if (msg == "editPersonal()") { |
616 | editPersonal(); | 616 | editPersonal(); |
617 | } else if (msg == "editPersonalAndClose()") { | 617 | } else if (msg == "editPersonalAndClose()") { |
618 | editPersonal(); | 618 | editPersonal(); |
619 | close(); | 619 | close(); |
620 | } else if ( msg == "addContact(QString,QString)" ) { | 620 | } else if ( msg == "addContact(QString,QString)" ) { |
621 | QDataStream stream(data,IO_ReadOnly); | 621 | QDataStream stream(data,IO_ReadOnly); |
622 | QString name, email; | 622 | QString name, email; |
623 | stream >> name >> email; | 623 | stream >> name >> email; |
624 | 624 | ||
625 | OContact cnt; | 625 | OContact cnt; |
626 | QString fn, mn, ln; | 626 | QString fn, mn, ln; |
627 | parseName( name, &fn, &mn, &ln ); | 627 | parseName( name, &fn, &mn, &ln ); |
628 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 628 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
629 | cnt.setFirstName( fn ); | 629 | cnt.setFirstName( fn ); |
630 | cnt.setMiddleName( mn ); | 630 | cnt.setMiddleName( mn ); |
631 | cnt.setLastName( ln ); | 631 | cnt.setLastName( ln ); |
632 | cnt.insertEmails( email ); | 632 | cnt.insertEmails( email ); |
633 | cnt.setDefaultEmail( email ); | 633 | cnt.setDefaultEmail( email ); |
634 | cnt.setFileAs(); | 634 | cnt.setFileAs(); |
635 | 635 | ||
636 | m_abView -> addEntry( cnt ); | 636 | m_abView -> addEntry( cnt ); |
637 | 637 | ||
638 | // :SXm_abView()->init( cnt ); | 638 | // :SXm_abView()->init( cnt ); |
639 | editEntry( EditEntry ); | 639 | editEntry( EditEntry ); |
640 | 640 | ||
641 | 641 | ||
642 | 642 | ||
643 | } | 643 | } |
644 | #if 0 | 644 | #if 0 |
645 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { | 645 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { |
646 | QDataStream stream(data,IO_ReadOnly); | 646 | QDataStream stream(data,IO_ReadOnly); |
647 | QCString ch,m; | 647 | QCString ch,m; |
648 | QStringList types; | 648 | QStringList types; |
649 | stream >> ch >> m >> types; | 649 | stream >> ch >> m >> types; |
650 | AddressPicker picker(abList,this,0,TRUE); | 650 | AddressPicker picker(abList,this,0,TRUE); |
651 | picker.showMaximized(); | 651 | picker.showMaximized(); |
652 | picker.setChoiceNames(types); | 652 | picker.setChoiceNames(types); |
653 | int i=0; | 653 | int i=0; |
654 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 654 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
655 | QStringList sel; | 655 | QStringList sel; |
656 | stream >> sel; | 656 | stream >> sel; |
657 | picker.setSelection(i++,sel); | 657 | picker.setSelection(i++,sel); |
658 | } | 658 | } |
659 | picker.showMaximized(); | 659 | picker.showMaximized(); |
660 | picker.exec(); | 660 | picker.exec(); |
661 | 661 | ||
662 | // ###### note: contacts may have been added - save here! | 662 | // ###### note: contacts may have been added - save here! |
663 | 663 | ||
664 | setCentralWidget(abList); | 664 | setCentralWidget(abList); |
665 | QCopEnvelope e(ch,m); | 665 | QCopEnvelope e(ch,m); |
666 | i=0; | 666 | i=0; |
667 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 667 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
668 | QStringList sel = picker.selection(i++); | 668 | QStringList sel = picker.selection(i++); |
669 | e << sel; | 669 | e << sel; |
670 | } | 670 | } |
671 | } | 671 | } |
672 | #endif | 672 | #endif |
673 | 673 | ||
674 | } | 674 | } |
675 | 675 | ||
676 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 676 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
677 | { | 677 | { |
678 | OContact entry; | 678 | OContact entry; |
679 | if ( !abEditor ) { | 679 | if ( !abEditor ) { |
680 | abEditor = new ContactEditor( entry, this, "editor" ); | 680 | abEditor = new ContactEditor( entry, this, "editor" ); |
681 | } | 681 | } |
682 | if ( entryMode == EditEntry ) | 682 | if ( entryMode == EditEntry ) |
683 | abEditor->setEntry( m_abView -> currentEntry() ); | 683 | abEditor->setEntry( m_abView -> currentEntry() ); |
684 | else if ( entryMode == NewEntry ) | 684 | else if ( entryMode == NewEntry ) |
685 | abEditor->setEntry( entry ); | 685 | abEditor->setEntry( entry ); |
686 | // other things may change the caption. | 686 | // other things may change the caption. |
687 | abEditor->setCaption( tr("Edit Address") ); | 687 | abEditor->setCaption( tr("Edit Address") ); |
688 | 688 | ||
689 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 689 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
690 | abEditor->showMaximized(); | 690 | abEditor->showMaximized(); |
691 | #endif | 691 | #endif |
692 | // fix the foxus... | 692 | // fix the foxus... |
693 | abEditor->setNameFocus(); | 693 | abEditor->setNameFocus(); |
694 | if ( abEditor->exec() ) { | 694 | if ( abEditor->exec() ) { |
695 | setFocus(); | 695 | setFocus(); |
696 | if ( entryMode == NewEntry ) { | 696 | if ( entryMode == NewEntry ) { |
697 | OContact insertEntry = abEditor->entry(); | 697 | OContact insertEntry = abEditor->entry(); |
698 | insertEntry.assignUid(); | 698 | insertEntry.assignUid(); |
699 | m_abView -> addEntry( insertEntry ); | 699 | m_abView -> addEntry( insertEntry ); |
700 | } else { | 700 | } else { |
701 | OContact replEntry = abEditor->entry(); | 701 | OContact replEntry = abEditor->entry(); |
702 | 702 | ||
703 | if ( !replEntry.isValidUid() ) | 703 | if ( !replEntry.isValidUid() ) |
704 | replEntry.assignUid(); | 704 | replEntry.assignUid(); |
705 | 705 | ||
706 | m_abView -> replaceEntry( replEntry ); | 706 | m_abView -> replaceEntry( replEntry ); |
707 | } | 707 | } |
708 | } | 708 | } |
709 | // populateCategories(); | 709 | // populateCategories(); |
710 | 710 | ||
711 | } | 711 | } |
712 | 712 | ||
713 | void AddressbookWindow::editPersonal() | 713 | void AddressbookWindow::editPersonal() |
714 | { | 714 | { |
715 | OContact entry; | 715 | OContact entry; |
716 | 716 | ||
717 | // Switch to personal view if not selected | 717 | // Switch to personal view if not selected |
718 | // but take care of the menu, too | 718 | // but take care of the menu, too |
719 | if ( ! actionPersonal->isOn() ){ | 719 | if ( ! actionPersonal->isOn() ){ |
720 | qWarning("*** ++++"); | 720 | qWarning("*** ++++"); |
721 | actionPersonal->setOn( true ); | 721 | actionPersonal->setOn( true ); |
722 | slotPersonalView(); | 722 | slotPersonalView(); |
723 | } | 723 | } |
724 | 724 | ||
725 | if ( !abEditor ) { | 725 | if ( !abEditor ) { |
726 | abEditor = new ContactEditor( entry, this, "editor" ); | 726 | abEditor = new ContactEditor( entry, this, "editor" ); |
727 | } | 727 | } |
728 | 728 | ||
729 | abEditor->setCaption(tr("Edit My Personal Details")); | 729 | abEditor->setCaption(tr("Edit My Personal Details")); |
730 | abEditor->setPersonalView( true ); | 730 | abEditor->setPersonalView( true ); |
731 | editEntry( EditEntry ); | 731 | editEntry( EditEntry ); |
732 | abEditor->setPersonalView( false ); | 732 | abEditor->setPersonalView( false ); |
733 | 733 | ||
734 | } | 734 | } |
735 | 735 | ||
736 | 736 | ||
737 | void AddressbookWindow::slotPersonalView() | 737 | void AddressbookWindow::slotPersonalView() |
738 | { | 738 | { |
739 | qWarning("slotPersonalView()"); | 739 | qWarning("slotPersonalView()"); |
740 | if (!actionPersonal->isOn()) { | 740 | if (!actionPersonal->isOn()) { |
741 | // we just turned it off | 741 | // we just turned it off |
742 | qWarning("slotPersonalView()-> OFF"); | 742 | qWarning("slotPersonalView()-> OFF"); |
743 | setCaption( tr("Contacts") ); | 743 | setCaption( tr("Contacts") ); |
744 | actionNew->setEnabled(TRUE); | 744 | actionNew->setEnabled(TRUE); |
745 | actionTrash->setEnabled(TRUE); | 745 | actionTrash->setEnabled(TRUE); |
746 | actionFind->setEnabled(TRUE); | 746 | actionFind->setEnabled(TRUE); |
747 | actionMail->setEnabled(TRUE); | 747 | actionMail->setEnabled(TRUE); |
748 | // slotUpdateToolbar(); | 748 | // slotUpdateToolbar(); |
749 | 749 | ||
750 | m_abView->showPersonal( false ); | 750 | m_abView->showPersonal( false ); |
751 | 751 | ||
752 | return; | 752 | return; |
753 | } | 753 | } |
754 | 754 | ||
755 | qWarning("slotPersonalView()-> ON"); | 755 | qWarning("slotPersonalView()-> ON"); |
756 | // XXX need to disable some QActions. | 756 | // XXX need to disable some QActions. |
757 | actionNew->setEnabled(FALSE); | 757 | actionNew->setEnabled(FALSE); |
758 | actionTrash->setEnabled(FALSE); | 758 | actionTrash->setEnabled(FALSE); |
759 | actionFind->setEnabled(FALSE); | 759 | actionFind->setEnabled(FALSE); |
760 | actionMail->setEnabled(FALSE); | 760 | actionMail->setEnabled(FALSE); |
761 | 761 | ||
762 | setCaption( tr("Contacts - My Personal Details") ); | 762 | setCaption( tr("Contacts - My Personal Details") ); |
763 | 763 | ||
764 | m_abView->showPersonal( true ); | 764 | m_abView->showPersonal( true ); |
765 | 765 | ||
766 | } | 766 | } |
767 | 767 | ||
768 | 768 | ||
769 | void AddressbookWindow::listIsEmpty( bool empty ) | 769 | void AddressbookWindow::listIsEmpty( bool empty ) |
770 | { | 770 | { |
771 | if ( !empty ) { | 771 | if ( !empty ) { |
772 | deleteButton->setEnabled( TRUE ); | 772 | deleteButton->setEnabled( TRUE ); |
773 | } | 773 | } |
774 | } | 774 | } |
775 | 775 | ||
776 | void AddressbookWindow::reload() | 776 | void AddressbookWindow::reload() |
777 | { | 777 | { |
778 | syncing = FALSE; | 778 | syncing = FALSE; |
779 | m_abView->clear(); | 779 | m_abView->clear(); |
780 | m_abView->reload(); | 780 | m_abView->reload(); |
781 | } | 781 | } |
782 | 782 | ||
783 | void AddressbookWindow::flush() | 783 | void AddressbookWindow::flush() |
784 | { | 784 | { |
785 | syncing = TRUE; | 785 | syncing = TRUE; |
786 | m_abView->save(); | 786 | m_abView->save(); |
787 | } | 787 | } |
788 | 788 | ||
789 | 789 | ||
790 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 790 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
791 | { | 791 | { |
792 | if(active_view == AbView::CardView){ | 792 | if(active_view == AbView::CardView){ |
793 | slotViewSwitched( AbView::TableView ); | 793 | slotViewSwitched( AbView::TableView ); |
794 | e->ignore(); | 794 | e->ignore(); |
795 | return; | 795 | return; |
796 | } | 796 | } |
797 | if(syncing) { | 797 | if(syncing) { |
798 | /* shouldn't we save, I hear you say? well its already been set | 798 | /* shouldn't we save, I hear you say? well its already been set |
799 | so that an edit can not occur during a sync, and we flushed | 799 | so that an edit can not occur during a sync, and we flushed |
800 | at the start of the sync, so there is no need to save | 800 | at the start of the sync, so there is no need to save |
801 | Saving however itself would cause problems. */ | 801 | Saving however itself would cause problems. */ |
802 | e->accept(); | 802 | e->accept(); |
803 | return; | 803 | return; |
804 | } | 804 | } |
805 | //################## shouldn't always save | 805 | //################## shouldn't always save |
806 | // True, but the database handles this automatically ! (se) | 806 | // True, but the database handles this automatically ! (se) |
807 | if ( save() ) | 807 | if ( save() ) |
808 | e->accept(); | 808 | e->accept(); |
809 | else | 809 | else |
810 | e->ignore(); | 810 | e->ignore(); |
811 | } | 811 | } |
812 | 812 | ||
813 | /* | 813 | /* |
814 | Returns TRUE if it is OK to exit | 814 | Returns TRUE if it is OK to exit |
815 | */ | 815 | */ |
816 | 816 | ||
817 | bool AddressbookWindow::save() | 817 | bool AddressbookWindow::save() |
818 | { | 818 | { |
819 | if ( !m_abView->save() ) { | 819 | if ( !m_abView->save() ) { |
820 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 820 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
821 | tr("Unable to save information.\n" | 821 | tr("Unable to save information.\n" |
822 | "Free up some space\n" | 822 | "Free up some space\n" |
823 | "and try again.\n" | 823 | "and try again.\n" |
824 | "\nQuit anyway?"), | 824 | "\nQuit anyway?"), |
825 | QMessageBox::Yes|QMessageBox::Escape, | 825 | QMessageBox::Yes|QMessageBox::Escape, |
826 | QMessageBox::No|QMessageBox::Default ) | 826 | QMessageBox::No|QMessageBox::Default ) |
827 | != QMessageBox::No ) | 827 | != QMessageBox::No ) |
828 | return TRUE; | 828 | return TRUE; |
829 | else | 829 | else |
830 | return FALSE; | 830 | return FALSE; |
831 | } | 831 | } |
832 | return TRUE; | 832 | return TRUE; |
833 | } | 833 | } |
834 | 834 | ||
835 | #ifdef __DEBUG_RELEASE | 835 | #ifdef __DEBUG_RELEASE |
836 | void AddressbookWindow::slotSave() | 836 | void AddressbookWindow::slotSave() |
837 | { | 837 | { |
838 | save(); | 838 | save(); |
839 | } | 839 | } |
840 | #endif | 840 | #endif |
841 | 841 | ||
842 | 842 | ||
843 | void AddressbookWindow::slotNotFound() | 843 | void AddressbookWindow::slotNotFound() |
844 | { | 844 | { |
845 | qWarning("Got notfound signal!"); | 845 | qWarning("Got notfound signal!"); |
846 | QMessageBox::information( this, tr( "Not Found" ), | 846 | QMessageBox::information( this, tr( "Not Found" ), |
847 | tr( "Unable to find a contact for this \n search pattern!" ) ); | 847 | tr( "Unable to find a contact for this \n search pattern!" ) ); |
848 | 848 | ||
849 | 849 | ||
850 | } | 850 | } |
851 | void AddressbookWindow::slotWrapAround() | 851 | void AddressbookWindow::slotWrapAround() |
852 | { | 852 | { |
853 | qWarning("Got wrap signal!"); | 853 | qWarning("Got wrap signal!"); |
854 | // if ( doNotifyWrapAround ) | 854 | // if ( doNotifyWrapAround ) |
855 | // QMessageBox::information( this, tr( "End of list" ), | 855 | // QMessageBox::information( this, tr( "End of list" ), |
856 | // tr( "End of list. Wrap around now...!" ) + "\n" ); | 856 | // tr( "End of list. Wrap around now...!" ) + "\n" ); |
857 | 857 | ||
858 | } | 858 | } |
859 | 859 | ||
860 | void AddressbookWindow::slotSetCategory( int c ) | 860 | void AddressbookWindow::slotSetCategory( int c ) |
861 | { | 861 | { |
862 | qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); | 862 | qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); |
863 | 863 | ||
864 | QString cat, book; | 864 | QString cat, book; |
865 | AbView::Views view = AbView::TableView; | 865 | AbView::Views view = AbView::TableView; |
866 | 866 | ||
867 | if ( c <= 0 ) | 867 | if ( c <= 0 ) |
868 | return; | 868 | return; |
869 | 869 | ||
870 | // Switch view | 870 | // Switch view |
871 | if ( c < 3 ) | 871 | if ( c < 3 ) |
872 | for ( unsigned int i = 1; i < 3; i++ ){ | 872 | for ( unsigned int i = 1; i < 3; i++ ){ |
873 | if ( catMenu ) | 873 | if ( catMenu ) |
874 | catMenu->setItemChecked( i, c == (int)i ); | 874 | catMenu->setItemChecked( i, c == (int)i ); |
875 | } | 875 | } |
876 | else | 876 | else |
877 | // Checkmark Category Menu Item Selected | 877 | // Checkmark Category Menu Item Selected |
878 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) | 878 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) |
879 | catMenu->setItemChecked( i, c == (int)i ); | 879 | catMenu->setItemChecked( i, c == (int)i ); |
880 | 880 | ||
881 | // Now switch to the selected category | 881 | // Now switch to the selected category |
882 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { | 882 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { |
883 | if (catMenu->isItemChecked( i )) { | 883 | if (catMenu->isItemChecked( i )) { |
884 | if ( i == 1 ){ // default List view | 884 | if ( i == 1 ){ // default List view |
885 | book = QString::null; | 885 | book = QString::null; |
886 | view = AbView::TableView; | 886 | view = AbView::TableView; |
887 | }else if ( i == 2 ){ | 887 | }else if ( i == 2 ){ |
888 | book = tr( "Cards" ); | 888 | book = tr( "Cards" ); |
889 | view = AbView::CardView; | 889 | view = AbView::CardView; |
890 | // }else if ( i == 3 ){ | 890 | // }else if ( i == 3 ){ |
891 | // book = tr( "Personal" ); | 891 | // book = tr( "Personal" ); |
892 | // view = AbView:: PersonalView; | 892 | // view = AbView:: PersonalView; |
893 | }else if ( i == 3 ){ // default All Categories | 893 | }else if ( i == 3 ){ // default All Categories |
894 | cat = QString::null; | 894 | cat = QString::null; |
895 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled | 895 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled |
896 | cat = "Unfiled"; | 896 | cat = "Unfiled"; |
897 | qWarning ("Unfiled selected!!!"); | 897 | qWarning ("Unfiled selected!!!"); |
898 | }else{ | 898 | }else{ |
899 | cat = m_abView->categories()[i - 4]; | 899 | cat = m_abView->categories()[i - 4]; |
900 | } | 900 | } |
901 | } | 901 | } |
902 | } | 902 | } |
903 | 903 | ||
904 | // Switch to the selected View | 904 | // Switch to the selected View |
905 | slotViewSwitched( view ); | 905 | slotViewSwitched( view ); |
906 | 906 | ||
907 | // Tell the view about the selected category | 907 | // Tell the view about the selected category |
908 | m_abView -> setShowByCategory( cat ); | 908 | m_abView -> setShowByCategory( cat ); |
909 | 909 | ||
910 | if ( book.isEmpty() ) | 910 | if ( book.isEmpty() ) |
911 | book = "List"; | 911 | book = "List"; |
912 | if ( cat.isEmpty() ) | 912 | if ( cat.isEmpty() ) |
913 | cat = "All"; | 913 | cat = "All"; |
914 | 914 | ||
915 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); | 915 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); |
916 | } | 916 | } |
917 | 917 | ||