-rw-r--r-- | core/pim/addressbook/ablabel.cpp | 18 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 57 | ||||
-rw-r--r-- | core/pim/addressbook/abview.cpp | 61 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 67 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg.cpp | 11 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 82 | ||||
-rw-r--r-- | core/pim/addressbook/opie-addressbook.control | 2 | ||||
-rw-r--r-- | core/pim/addressbook/picker.cpp | 28 |
8 files changed, 170 insertions, 156 deletions
diff --git a/core/pim/addressbook/ablabel.cpp b/core/pim/addressbook/ablabel.cpp index 70a66a0..8216d6f 100644 --- a/core/pim/addressbook/ablabel.cpp +++ b/core/pim/addressbook/ablabel.cpp | |||
@@ -1,144 +1,144 @@ | |||
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 | 20 | ||
21 | #include "ablabel.h" | 21 | #include "ablabel.h" |
22 | 22 | ||
23 | 23 | #include <opie2/odebug.h> | |
24 | 24 | ||
25 | AbLabel::AbLabel( QWidget *parent, const char *name ): | 25 | AbLabel::AbLabel( QWidget *parent, const char *name ): |
26 | QTextView( parent, name ), | 26 | QTextView( parent, name ), |
27 | m_empty( false ) | 27 | m_empty( false ) |
28 | { | 28 | { |
29 | } | 29 | } |
30 | 30 | ||
31 | AbLabel::~AbLabel() | 31 | AbLabel::~AbLabel() |
32 | { | 32 | { |
33 | } | 33 | } |
34 | 34 | ||
35 | void AbLabel::setContacts( const Opie::OPimContactAccess::List& viewList ) | 35 | void AbLabel::setContacts( const Opie::OPimContactAccess::List& viewList ) |
36 | { | 36 | { |
37 | m_viewList = viewList; | 37 | m_viewList = viewList; |
38 | if (m_viewList.count() != 0){ | 38 | if (m_viewList.count() != 0){ |
39 | m_empty = false; | 39 | m_empty = false; |
40 | m_itCurContact = m_viewList.begin(); | 40 | m_itCurContact = m_viewList.begin(); |
41 | sync(); | 41 | sync(); |
42 | }else{ | 42 | }else{ |
43 | // m_itCurContact.clear(); | 43 | // m_itCurContact.clear(); |
44 | m_empty = true; | 44 | m_empty = true; |
45 | setText( "" ); | 45 | setText( "" ); |
46 | } | 46 | } |
47 | } | 47 | } |
48 | 48 | ||
49 | int AbLabel::currentEntry_UID() | 49 | int AbLabel::currentEntry_UID() |
50 | { | 50 | { |
51 | Opie::OPimContact contact = currentEntry(); | 51 | Opie::OPimContact contact = currentEntry(); |
52 | 52 | ||
53 | if ( contact.isEmpty() ) | 53 | if ( contact.isEmpty() ) |
54 | return 0; | 54 | return 0; |
55 | else | 55 | else |
56 | return ( contact.uid() ); | 56 | return ( contact.uid() ); |
57 | } | 57 | } |
58 | 58 | ||
59 | Opie::OPimContact AbLabel::currentEntry() | 59 | Opie::OPimContact AbLabel::currentEntry() |
60 | { | 60 | { |
61 | if ( ! m_empty ) | 61 | if ( ! m_empty ) |
62 | return ( *m_itCurContact ); | 62 | return ( *m_itCurContact ); |
63 | else | 63 | else |
64 | return Opie::OPimContact(); | 64 | return Opie::OPimContact(); |
65 | } | 65 | } |
66 | 66 | ||
67 | 67 | ||
68 | bool AbLabel::selectContact( int UID ) | 68 | bool AbLabel::selectContact( int UID ) |
69 | { | 69 | { |
70 | 70 | ||
71 | for ( int r = 0; r < m_viewList.count(); ++r ) { | 71 | for ( int r = 0; r < m_viewList.count(); ++r ) { |
72 | if ( m_viewList.uidAt( r ) == UID ){ | 72 | if ( m_viewList.uidAt( r ) == UID ){ |
73 | m_itCurContact.setCurrent( r ); | 73 | m_itCurContact.setCurrent( r ); |
74 | break; | 74 | break; |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | sync(); | 78 | sync(); |
79 | 79 | ||
80 | return true; | 80 | return true; |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | 84 | ||
85 | void AbLabel::sync() | 85 | void AbLabel::sync() |
86 | { | 86 | { |
87 | QString text = (*m_itCurContact).toRichText(); | 87 | QString text = (*m_itCurContact).toRichText(); |
88 | setText( text ); | 88 | setText( text ); |
89 | } | 89 | } |
90 | 90 | ||
91 | void AbLabel::keyPressEvent( QKeyEvent *e ) | 91 | void AbLabel::keyPressEvent( QKeyEvent *e ) |
92 | { | 92 | { |
93 | 93 | ||
94 | // Commonly handled keys | 94 | // Commonly handled keys |
95 | if ( !m_empty ){ | 95 | if ( !m_empty ){ |
96 | switch( e->key() ) { | 96 | switch( e->key() ) { |
97 | case Qt::Key_Left: | 97 | case Qt::Key_Left: |
98 | qWarning( "Left.."); | 98 | Opie::Core::owarn << "Left.." << oendl; |
99 | case Qt::Key_Right: | 99 | case Qt::Key_Right: |
100 | qWarning( "Right.."); | 100 | Opie::Core::owarn << "Right.." << oendl; |
101 | case Qt::Key_F33: | 101 | case Qt::Key_F33: |
102 | qWarning( "OK.."); | 102 | Opie::Core::owarn << "OK.." << oendl; |
103 | emit signalOkPressed(); | 103 | emit signalOkPressed(); |
104 | break; | 104 | break; |
105 | case Qt::Key_Up: | 105 | case Qt::Key_Up: |
106 | qWarning( "UP.."); | 106 | Opie::Core::owarn << "Up.." << oendl; |
107 | if ( ( visibleHeight() < contentsHeight() ) && | 107 | if ( ( visibleHeight() < contentsHeight() ) && |
108 | ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) ) | 108 | ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) ) |
109 | scrollBy( 0, -(visibleHeight()-20) ); | 109 | scrollBy( 0, -(visibleHeight()-20) ); |
110 | else { | 110 | else { |
111 | --m_itCurContact; | 111 | --m_itCurContact; |
112 | if ( *m_itCurContact != Opie::OPimContact() ) | 112 | if ( *m_itCurContact != Opie::OPimContact() ) |
113 | sync(); | 113 | sync(); |
114 | else | 114 | else |
115 | m_itCurContact = m_viewList.end(); | 115 | m_itCurContact = m_viewList.end(); |
116 | } | 116 | } |
117 | 117 | ||
118 | break; | 118 | break; |
119 | case Qt::Key_Down: | 119 | case Qt::Key_Down: |
120 | qWarning( "DOWN.."); | 120 | Opie::Core::owarn << "Down.." << oendl; |
121 | // qWarning( "visible: %d, content: %d",visibleHeight(),contentsHeight()); | 121 | // Opie::Core::owarn << "Visible: " << visibleHeight() << ", content: " << contentHeight() << oendl; |
122 | // qWarning( "value: %d; barMaxValue: %d", verticalScrollBar()->value() | 122 | // Opie::Core::owarn << "Value: " << verticalScrollBar()->value() |
123 | // , verticalScrollBar()->maxValue() ); | 123 | // << ", barMaxValue: " << verticalScrollBar()->maxValue() << oendl; |
124 | if ( ( visibleHeight() < contentsHeight() ) && | 124 | if ( ( visibleHeight() < contentsHeight() ) && |
125 | ( verticalScrollBar()->value() < verticalScrollBar()->maxValue() ) ) | 125 | ( verticalScrollBar()->value() < verticalScrollBar()->maxValue() ) ) |
126 | scrollBy( 0, visibleHeight()-20 ); | 126 | scrollBy( 0, visibleHeight()-20 ); |
127 | else { | 127 | else { |
128 | ++m_itCurContact; | 128 | ++m_itCurContact; |
129 | if ( *m_itCurContact != Opie::OPimContact() ) | 129 | if ( *m_itCurContact != Opie::OPimContact() ) |
130 | sync(); | 130 | sync(); |
131 | else | 131 | else |
132 | m_itCurContact = m_viewList.begin(); | 132 | m_itCurContact = m_viewList.begin(); |
133 | } | 133 | } |
134 | break; | 134 | break; |
135 | case Qt::Key_Return: // fall through | 135 | case Qt::Key_Return: // fall through |
136 | case Qt::Key_Space: // fall through | 136 | case Qt::Key_Space: // fall through |
137 | case Qt::Key_Enter: // we want to switch back | 137 | case Qt::Key_Enter: // we want to switch back |
138 | emit signalOkPressed(); | 138 | emit signalOkPressed(); |
139 | break; | 139 | break; |
140 | default: break; | 140 | default: break; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | } | 144 | } |
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index cd77b13..cb57342 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -1,838 +1,841 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) | 3 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) |
4 | ** | 4 | ** |
5 | ** This file is part of Qt Palmtop Environment. | 5 | ** This file is part of Qt 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 | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging 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 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | 22 | #include <opie2/odebug.h> | |
23 | #include <opie2/opimrecordlist.h> | 23 | #include <opie2/opimrecordlist.h> |
24 | 24 | ||
25 | #include <qpe/timestring.h> | 25 | #include <qpe/timestring.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | 27 | ||
28 | #include "abtable.h" | 28 | #include "abtable.h" |
29 | 29 | ||
30 | #include <errno.h> | 30 | #include <errno.h> |
31 | #include <fcntl.h> | 31 | #include <fcntl.h> |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #include <stdlib.h> | 33 | #include <stdlib.h> |
34 | 34 | ||
35 | #include <ctype.h> //toupper() for key hack | 35 | #include <ctype.h> //toupper() for key hack |
36 | 36 | ||
37 | #if 0 | 37 | #if 0 |
38 | 38 | ||
39 | /*! | 39 | /*! |
40 | \class AbTableItem abtable.h | 40 | \class AbTableItem abtable.h |
41 | 41 | ||
42 | \brief QTableItem based class for showing a field of an entry | 42 | \brief QTableItem based class for showing a field of an entry |
43 | */ | 43 | */ |
44 | 44 | ||
45 | AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, | 45 | AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, |
46 | const QString &secondSortKey) | 46 | const QString &secondSortKey) |
47 | : QTableItem( t, et, s ) | 47 | : QTableItem( t, et, s ) |
48 | { | 48 | { |
49 | // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); | 49 | // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); |
50 | sortKey = Qtopia::buildSortKey( s, secondSortKey ); | 50 | sortKey = Qtopia::buildSortKey( s, secondSortKey ); |
51 | } | 51 | } |
52 | 52 | ||
53 | int AbTableItem::alignment() const | 53 | int AbTableItem::alignment() const |
54 | { | 54 | { |
55 | return AlignLeft|AlignVCenter; | 55 | return AlignLeft|AlignVCenter; |
56 | } | 56 | } |
57 | 57 | ||
58 | QString AbTableItem::key() const | 58 | QString AbTableItem::key() const |
59 | { | 59 | { |
60 | return sortKey; | 60 | return sortKey; |
61 | } | 61 | } |
62 | 62 | ||
63 | // A way to reset the item, without out doing a delete or a new... | 63 | // A way to reset the item, without out doing a delete or a new... |
64 | void AbTableItem::setItem( const QString &txt, const QString &secondKey ) | 64 | void AbTableItem::setItem( const QString &txt, const QString &secondKey ) |
65 | { | 65 | { |
66 | setText( txt ); | 66 | setText( txt ); |
67 | sortKey = Qtopia::buildSortKey( txt, secondKey ); | 67 | sortKey = Qtopia::buildSortKey( txt, secondKey ); |
68 | 68 | ||
69 | // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); | 69 | // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); |
70 | } | 70 | } |
71 | 71 | ||
72 | /*! | 72 | /*! |
73 | \class AbPickItem abtable.h | 73 | \class AbPickItem abtable.h |
74 | 74 | ||
75 | \brief QTableItem based class for showing slection of an entry | 75 | \brief QTableItem based class for showing slection of an entry |
76 | */ | 76 | */ |
77 | 77 | ||
78 | AbPickItem::AbPickItem( QTable *t ) : | 78 | AbPickItem::AbPickItem( QTable *t ) : |
79 | QTableItem(t, WhenCurrent, "?") | 79 | QTableItem(t, WhenCurrent, "?") |
80 | { | 80 | { |
81 | } | 81 | } |
82 | 82 | ||
83 | QWidget *AbPickItem::createEditor() const | 83 | QWidget *AbPickItem::createEditor() const |
84 | { | 84 | { |
85 | QComboBox* combo = new QComboBox( table()->viewport() ); | 85 | QComboBox* combo = new QComboBox( table()->viewport() ); |
86 | ( (AbPickItem*)this )->cb = combo; | 86 | ( (AbPickItem*)this )->cb = combo; |
87 | AbTable* t = static_cast<AbTable*>(table()); | 87 | AbTable* t = static_cast<AbTable*>(table()); |
88 | QStringList c = t->choiceNames(); | 88 | QStringList c = t->choiceNames(); |
89 | int cur = 0; | 89 | int cur = 0; |
90 | for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { | 90 | for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { |
91 | if ( *it == text() ) | 91 | if ( *it == text() ) |
92 | cur = combo->count(); | 92 | cur = combo->count(); |
93 | combo->insertItem(*it); | 93 | combo->insertItem(*it); |
94 | } | 94 | } |
95 | combo->setCurrentItem(cur); | 95 | combo->setCurrentItem(cur); |
96 | return combo; | 96 | return combo; |
97 | } | 97 | } |
98 | 98 | ||
99 | void AbPickItem::setContentFromEditor( QWidget *w ) | 99 | void AbPickItem::setContentFromEditor( QWidget *w ) |
100 | { | 100 | { |
101 | if ( w->inherits("QComboBox") ) | 101 | if ( w->inherits("QComboBox") ) |
102 | setText( ( (QComboBox*)w )->currentText() ); | 102 | setText( ( (QComboBox*)w )->currentText() ); |
103 | else | 103 | else |
104 | QTableItem::setContentFromEditor( w ); | 104 | QTableItem::setContentFromEditor( w ); |
105 | } | 105 | } |
106 | 106 | ||
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | /*! | 109 | /*! |
110 | \class AbTable abtable.h | 110 | \class AbTable abtable.h |
111 | 111 | ||
112 | \brief QTable based class for showing a list of entries | 112 | \brief QTable based class for showing a list of entries |
113 | */ | 113 | */ |
114 | 114 | ||
115 | AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name ) | 115 | AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name ) |
116 | : QTable( parent, name ), | 116 | : QTable( parent, name ), |
117 | lastSortCol( -1 ), | 117 | lastSortCol( -1 ), |
118 | asc( TRUE ), | 118 | asc( TRUE ), |
119 | intFields( order ), | 119 | intFields( order ), |
120 | enablePainting( true ), | 120 | enablePainting( true ), |
121 | columnVisible( true ), | 121 | columnVisible( true ), |
122 | countNested( 0 ) | 122 | countNested( 0 ) |
123 | { | 123 | { |
124 | //qWarning("C'tor start"); | 124 | //Opie::Core::owarn << "C'tor start" << oendl; |
125 | |||
126 | setSelectionMode( NoSelection ); | 125 | setSelectionMode( NoSelection ); |
127 | init(); | 126 | init(); |
128 | setSorting( TRUE ); | 127 | setSorting( TRUE ); |
129 | connect( this, SIGNAL(clicked(int,int,int,const QPoint&)), | 128 | connect( this, SIGNAL(clicked(int,int,int,const QPoint&)), |
130 | this, SLOT(itemClicked(int,int)) ); | 129 | this, SLOT(itemClicked(int,int)) ); |
131 | 130 | ||
132 | // contactList.clear(); | 131 | // contactList.clear(); |
133 | //qWarning("C'tor end"); | 132 | //Opie::Core::owarn << "C'tor end" << oendl; |
134 | } | 133 | } |
135 | 134 | ||
136 | AbTable::~AbTable() | 135 | AbTable::~AbTable() |
137 | { | 136 | { |
138 | } | 137 | } |
139 | 138 | ||
140 | void AbTable::init() | 139 | void AbTable::init() |
141 | { | 140 | { |
142 | // :SX showChar = '\0'; | 141 | // :SX showChar = '\0'; |
143 | setNumRows( 0 ); | 142 | setNumRows( 0 ); |
144 | setNumCols( 2 ); | 143 | setNumCols( 2 ); |
145 | 144 | ||
146 | horizontalHeader()->setLabel( 0, tr( "Full Name" )); | 145 | horizontalHeader()->setLabel( 0, tr( "Full Name" )); |
147 | horizontalHeader()->setLabel( 1, tr( "Contact" )); | 146 | horizontalHeader()->setLabel( 1, tr( "Contact" )); |
148 | setLeftMargin( 0 ); | 147 | setLeftMargin( 0 ); |
149 | verticalHeader()->hide(); | 148 | verticalHeader()->hide(); |
150 | columnVisible = true; | 149 | columnVisible = true; |
151 | } | 150 | } |
152 | 151 | ||
153 | void AbTable::setContacts( const Opie::OPimContactAccess::List& viewList ) | 152 | void AbTable::setContacts( const Opie::OPimContactAccess::List& viewList ) |
154 | { | 153 | { |
155 | qWarning("AbTable::setContacts()"); | 154 | Opie::Core::owarn << "AbTable::setContacts()" << oendl; |
156 | 155 | ||
157 | clear(); | 156 | clear(); |
158 | m_viewList = viewList; | 157 | m_viewList = viewList; |
159 | 158 | ||
160 | setSorting( false ); | 159 | setSorting( false ); |
161 | setPaintingEnabled( FALSE ); | 160 | setPaintingEnabled( FALSE ); |
162 | 161 | ||
163 | Opie::OPimContactAccess::List::Iterator it; | 162 | Opie::OPimContactAccess::List::Iterator it; |
164 | setNumRows( m_viewList.count() ); | 163 | setNumRows( m_viewList.count() ); |
165 | //int row = 0; | 164 | //int row = 0; |
166 | // for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) | 165 | // for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) |
167 | // insertIntoTable( *it, row++ ); | 166 | // insertIntoTable( *it, row++ ); |
168 | 167 | ||
169 | // setSorting( true ); | 168 | // setSorting( true ); |
170 | 169 | ||
171 | // resort(); | 170 | // resort(); |
172 | 171 | ||
173 | updateVisible(); | 172 | updateVisible(); |
174 | 173 | ||
175 | setPaintingEnabled( TRUE ); | 174 | setPaintingEnabled( TRUE ); |
176 | 175 | ||
177 | } | 176 | } |
178 | 177 | ||
179 | void AbTable::setOrderedList( const QValueList<int> ordered ) | 178 | void AbTable::setOrderedList( const QValueList<int> ordered ) |
180 | { | 179 | { |
181 | intFields = ordered; | 180 | intFields = ordered; |
182 | } | 181 | } |
183 | 182 | ||
184 | 183 | ||
185 | bool AbTable::selectContact( int UID ) | 184 | bool AbTable::selectContact( int UID ) |
186 | { | 185 | { |
187 | qWarning( "AbTable::selectContact( %d )", UID ); | 186 | Opie::Core::owarn << "AbTable::selectContact( " << UID << " )" << oendl; |
188 | int rows = numRows(); | 187 | int rows = numRows(); |
189 | Opie::OPimContact* foundContact = 0l; | 188 | Opie::OPimContact* foundContact = 0l; |
190 | bool found = false; | 189 | bool found = false; |
191 | 190 | ||
192 | setPaintingEnabled( FALSE ); | 191 | setPaintingEnabled( FALSE ); |
193 | qWarning( "search start" ); | 192 | Opie::Core::owarn << "Search start" << oendl; |
194 | for ( int r = 0; r < rows; ++r ) { | 193 | for ( int r = 0; r < rows; ++r ) { |
195 | if ( m_viewList.uidAt( r ) == UID ){ | 194 | if ( m_viewList.uidAt( r ) == UID ){ |
196 | ensureCellVisible( r, 0 ); | 195 | ensureCellVisible( r, 0 ); |
197 | setCurrentCell( r, 0 ); | 196 | setCurrentCell( r, 0 ); |
198 | found = true; | 197 | found = true; |
199 | break; | 198 | break; |
200 | } | 199 | } |
201 | } | 200 | } |
202 | qWarning( "search end" ); | 201 | Opie::Core::owarn << "Search end" << oendl; |
203 | 202 | ||
204 | if ( !found ){ | 203 | if ( !found ){ |
205 | ensureCellVisible( 0,0 ); | 204 | ensureCellVisible( 0,0 ); |
206 | setCurrentCell( 0, 0 ); | 205 | setCurrentCell( 0, 0 ); |
207 | } | 206 | } |
208 | 207 | ||
209 | setPaintingEnabled( TRUE ); | 208 | setPaintingEnabled( TRUE ); |
210 | 209 | ||
211 | return true; | 210 | return true; |
212 | } | 211 | } |
213 | 212 | ||
214 | #if 0 | 213 | #if 0 |
215 | void AbTable::insertIntoTable( const Opie::OPimContact& cnt, int row ) | 214 | void AbTable::insertIntoTable( const Opie::OPimContact& cnt, int row ) |
216 | { | 215 | { |
217 | qWarning( "void AbTable::insertIntoTable( const Opie::OPimContact& cnt, %d )", row ); | 216 | Opie::Core::owarn << "void AbTable::insertIntoTable( const Opie::OPimContact& cnt, " |
217 | << row << " )" << oendl; | ||
218 | QString strName; | 218 | QString strName; |
219 | ContactItem contactItem; | 219 | ContactItem contactItem; |
220 | 220 | ||
221 | strName = findContactName( cnt ); | 221 | strName = findContactName( cnt ); |
222 | contactItem = findContactContact( cnt, row ); | 222 | contactItem = findContactContact( cnt, row ); |
223 | 223 | ||
224 | AbTableItem *ati; | 224 | AbTableItem *ati; |
225 | ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value ); | 225 | ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value ); |
226 | contactList.insert( ati, cnt ); | 226 | contactList.insert( ati, cnt ); |
227 | setItem( row, 0, ati ); | 227 | setItem( row, 0, ati ); |
228 | ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName); | 228 | ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName); |
229 | if ( !contactItem.icon.isNull() ) | 229 | if ( !contactItem.icon.isNull() ) |
230 | ati->setPixmap( contactItem.icon ); | 230 | ati->setPixmap( contactItem.icon ); |
231 | setItem( row, 1, ati ); | 231 | setItem( row, 1, ati ); |
232 | 232 | ||
233 | //### cannot do this; table only has two columns at this point | 233 | //### cannot do this; table only has two columns at this point |
234 | // setItem( row, 2, new AbPickItem( this ) ); | 234 | // setItem( row, 2, new AbPickItem( this ) ); |
235 | 235 | ||
236 | } | 236 | } |
237 | #endif | 237 | #endif |
238 | 238 | ||
239 | 239 | ||
240 | void AbTable::columnClicked( int col ) | 240 | void AbTable::columnClicked( int col ) |
241 | { | 241 | { |
242 | if ( !sorting() ) | 242 | if ( !sorting() ) |
243 | return; | 243 | return; |
244 | 244 | ||
245 | if ( lastSortCol == -1 ) | 245 | if ( lastSortCol == -1 ) |
246 | lastSortCol = col; | 246 | lastSortCol = col; |
247 | 247 | ||
248 | if ( col == lastSortCol ) { | 248 | if ( col == lastSortCol ) { |
249 | asc = !asc; | 249 | asc = !asc; |
250 | } else { | 250 | } else { |
251 | lastSortCol = col; | 251 | lastSortCol = col; |
252 | asc = TRUE; | 252 | asc = TRUE; |
253 | } | 253 | } |
254 | //QMessageBox::information( this, "resort", "columnClicked" ); | 254 | //QMessageBox::information( this, "resort", "columnClicked" ); |
255 | resort(); | 255 | resort(); |
256 | } | 256 | } |
257 | 257 | ||
258 | void AbTable::resort() | 258 | void AbTable::resort() |
259 | { | 259 | { |
260 | qWarning( "void AbTable::resort() NOT POSSIBLE !!" ); | 260 | Opie::Core::owarn << "void AbTable::resort() NOT POSSIBLE !!" << oendl; |
261 | #if 0 | 261 | #if 0 |
262 | setPaintingEnabled( FALSE ); | 262 | setPaintingEnabled( FALSE ); |
263 | if ( sorting() ) { | 263 | if ( sorting() ) { |
264 | if ( lastSortCol == -1 ) | 264 | if ( lastSortCol == -1 ) |
265 | lastSortCol = 0; | 265 | lastSortCol = 0; |
266 | sortColumn( lastSortCol, asc, TRUE ); | 266 | sortColumn( lastSortCol, asc, TRUE ); |
267 | //QMessageBox::information( this, "resort", "resort" ); | 267 | //QMessageBox::information( this, "resort", "resort" ); |
268 | updateVisible(); | 268 | updateVisible(); |
269 | } | 269 | } |
270 | setPaintingEnabled( TRUE ); | 270 | setPaintingEnabled( TRUE ); |
271 | #endif | 271 | #endif |
272 | } | 272 | } |
273 | 273 | ||
274 | Opie::OPimContact AbTable::currentEntry() | 274 | Opie::OPimContact AbTable::currentEntry() |
275 | { | 275 | { |
276 | return m_viewList[currentRow()]; | 276 | return m_viewList[currentRow()]; |
277 | } | 277 | } |
278 | 278 | ||
279 | int AbTable::currentEntry_UID() | 279 | int AbTable::currentEntry_UID() |
280 | { | 280 | { |
281 | return ( currentEntry().uid() ); | 281 | return ( currentEntry().uid() ); |
282 | } | 282 | } |
283 | 283 | ||
284 | void AbTable::clear() | 284 | void AbTable::clear() |
285 | { | 285 | { |
286 | qWarning( "void AbTable::clear()" ); | 286 | Opie::Core::owarn << "void AbTable::clear()" << oendl; |
287 | // contactList.clear(); | 287 | // contactList.clear(); |
288 | 288 | ||
289 | setPaintingEnabled( FALSE ); | 289 | setPaintingEnabled( FALSE ); |
290 | for ( int r = 0; r < numRows(); ++r ) { | 290 | for ( int r = 0; r < numRows(); ++r ) { |
291 | for ( int c = 0; c < numCols(); ++c ) { | 291 | for ( int c = 0; c < numCols(); ++c ) { |
292 | if ( cellWidget( r, c ) ) | 292 | if ( cellWidget( r, c ) ) |
293 | clearCellWidget( r, c ); | 293 | clearCellWidget( r, c ); |
294 | clearCell( r, c ); | 294 | clearCell( r, c ); |
295 | } | 295 | } |
296 | } | 296 | } |
297 | setNumRows( 0 ); | 297 | setNumRows( 0 ); |
298 | setPaintingEnabled( TRUE ); | 298 | setPaintingEnabled( TRUE ); |
299 | } | 299 | } |
300 | 300 | ||
301 | // Refresh updates column 2 if the contactsettings changed | 301 | // Refresh updates column 2 if the contactsettings changed |
302 | void AbTable::refresh() | 302 | void AbTable::refresh() |
303 | { | 303 | { |
304 | qWarning( "void AbTable::refresh() NOT IMPLEMENTED !!" ); | 304 | Opie::Core::owarn << "void AbTable::refresh() NOT IMPLEMENTED !!" << oendl; |
305 | 305 | ||
306 | #if 0 | 306 | #if 0 |
307 | int rows = numRows(); | 307 | int rows = numRows(); |
308 | AbTableItem *abi; | 308 | AbTableItem *abi; |
309 | ContactItem contactItem; | 309 | ContactItem contactItem; |
310 | 310 | ||
311 | setPaintingEnabled( FALSE ); | 311 | setPaintingEnabled( FALSE ); |
312 | for ( int r = 0; r < rows; ++r ) { | 312 | for ( int r = 0; r < rows; ++r ) { |
313 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 313 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
314 | contactItem = findContactContact( contactList[abi], r ); | 314 | contactItem = findContactContact( contactList[abi], r ); |
315 | static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() ); | 315 | static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() ); |
316 | if ( !contactItem.icon.isNull() ){ | 316 | if ( !contactItem.icon.isNull() ){ |
317 | static_cast<AbTableItem*>( item(r, 1) )-> | 317 | static_cast<AbTableItem*>( item(r, 1) )-> |
318 | setPixmap( contactItem.icon ); | 318 | setPixmap( contactItem.icon ); |
319 | }else{ | 319 | }else{ |
320 | static_cast<AbTableItem*>( item(r, 1) )-> | 320 | static_cast<AbTableItem*>( item(r, 1) )-> |
321 | setPixmap( QPixmap() ); | 321 | setPixmap( QPixmap() ); |
322 | } | 322 | } |
323 | } | 323 | } |
324 | resort(); | 324 | resort(); |
325 | setPaintingEnabled( TRUE ); | 325 | setPaintingEnabled( TRUE ); |
326 | 326 | ||
327 | #endif | 327 | #endif |
328 | } | 328 | } |
329 | 329 | ||
330 | void AbTable::keyPressEvent( QKeyEvent *e ) | 330 | void AbTable::keyPressEvent( QKeyEvent *e ) |
331 | { | 331 | { |
332 | char key = toupper( e->ascii() ); | 332 | char key = toupper( e->ascii() ); |
333 | 333 | ||
334 | if ( key >= 'A' && key <= 'Z' ) | 334 | if ( key >= 'A' && key <= 'Z' ) |
335 | moveTo( key ); | 335 | moveTo( key ); |
336 | 336 | ||
337 | //qWarning("Received key .."); | 337 | // Opie::Core::owarn << "Received key .." << oendl; |
338 | switch( e->key() ) { | 338 | switch( e->key() ) { |
339 | case Qt::Key_Space: | 339 | case Qt::Key_Space: |
340 | case Qt::Key_Return: | 340 | case Qt::Key_Return: |
341 | case Qt::Key_Enter: | 341 | case Qt::Key_Enter: |
342 | emit signalSwitch(); | 342 | emit signalSwitch(); |
343 | break; | 343 | break; |
344 | // case Qt::Key_Up: | 344 | // case Qt::Key_Up: |
345 | // qWarning("a"); | 345 | // Opie::Core::owarn << "a" << oendl; |
346 | // emit signalKeyUp(); | 346 | // emit signalKeyUp(); |
347 | // break; | 347 | // break; |
348 | // case Qt::Key_Down: | 348 | // case Qt::Key_Down: |
349 | // qWarning("b"); | 349 | // Opie::Core::owarn << "b" << oendl; |
350 | // emit signalKeyDown(); | 350 | // emit signalKeyDown(); |
351 | // break; | 351 | // break; |
352 | default: | 352 | default: |
353 | QTable::keyPressEvent( e ); | 353 | QTable::keyPressEvent( e ); |
354 | } | 354 | } |
355 | 355 | ||
356 | } | 356 | } |
357 | 357 | ||
358 | void AbTable::moveTo( char c ) | 358 | void AbTable::moveTo( char c ) |
359 | { | 359 | { |
360 | qWarning( "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" ); | 360 | Opie::Core::owarn << "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" << oendl; |
361 | 361 | ||
362 | #if 0 | 362 | #if 0 |
363 | int rows = numRows(); | 363 | int rows = numRows(); |
364 | QString value; | 364 | QString value; |
365 | AbTableItem *abi; | 365 | AbTableItem *abi; |
366 | int r; | 366 | int r; |
367 | if ( asc ) { | 367 | if ( asc ) { |
368 | r = 0; | 368 | r = 0; |
369 | while ( r < rows-1) { | 369 | while ( r < rows-1) { |
370 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 370 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
371 | QChar first = abi->key()[0]; | 371 | QChar first = abi->key()[0]; |
372 | //### is there a bug in QChar to char comparison??? | 372 | //### is there a bug in QChar to char comparison??? |
373 | if ( first.row() || first.cell() >= c ) | 373 | if ( first.row() || first.cell() >= c ) |
374 | break; | 374 | break; |
375 | r++; | 375 | r++; |
376 | } | 376 | } |
377 | } else { | 377 | } else { |
378 | //### should probably disable reverse sorting instead | 378 | //### should probably disable reverse sorting instead |
379 | r = rows - 1; | 379 | r = rows - 1; |
380 | while ( r > 0 ) { | 380 | while ( r > 0 ) { |
381 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 381 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
382 | QChar first = abi->key()[0]; | 382 | QChar first = abi->key()[0]; |
383 | //### is there a bug in QChar to char comparison??? | 383 | //### is there a bug in QChar to char comparison??? |
384 | if ( first.row() || first.cell() >= c ) | 384 | if ( first.row() || first.cell() >= c ) |
385 | break; | 385 | break; |
386 | r--; | 386 | r--; |
387 | } | 387 | } |
388 | } | 388 | } |
389 | setCurrentCell( r, currentColumn() ); | 389 | setCurrentCell( r, currentColumn() ); |
390 | 390 | ||
391 | #endif | 391 | #endif |
392 | } | 392 | } |
393 | 393 | ||
394 | #if 0 | 394 | #if 0 |
395 | // Useless.. Nobody uses it .. (se) | 395 | // Useless.. Nobody uses it .. (se) |
396 | QString AbTable::findContactName( const Opie::OPimContact &entry ) | 396 | QString AbTable::findContactName( const Opie::OPimContact &entry ) |
397 | { | 397 | { |
398 | // We use the fileAs, then company, defaultEmail | 398 | // We use the fileAs, then company, defaultEmail |
399 | QString str; | 399 | QString str; |
400 | str = entry.fileAs(); | 400 | str = entry.fileAs(); |
401 | if ( str.isEmpty() ) { | 401 | if ( str.isEmpty() ) { |
402 | str = entry.company(); | 402 | str = entry.company(); |
403 | if ( str.isEmpty() ) { | 403 | if ( str.isEmpty() ) { |
404 | str = entry.defaultEmail(); | 404 | str = entry.defaultEmail(); |
405 | } | 405 | } |
406 | } | 406 | } |
407 | return str; | 407 | return str; |
408 | } | 408 | } |
409 | #endif | 409 | #endif |
410 | 410 | ||
411 | 411 | ||
412 | void AbTable::resizeRows() { | 412 | void AbTable::resizeRows() { |
413 | /* | 413 | /* |
414 | if (numRows()) { | 414 | if (numRows()) { |
415 | for (int i = 0; i < numRows(); i++) { | 415 | for (int i = 0; i < numRows(); i++) { |
416 | setRowHeight( i, size ); | 416 | setRowHeight( i, size ); |
417 | } | 417 | } |
418 | } | 418 | } |
419 | updateVisible(); | 419 | updateVisible(); |
420 | */ | 420 | */ |
421 | } | 421 | } |
422 | 422 | ||
423 | 423 | ||
424 | void AbTable::realignTable() | 424 | void AbTable::realignTable() |
425 | { | 425 | { |
426 | //qWarning( "void AbTable::realignTable()" ); | 426 | //Opie::Core::owarn << "void AbTable::realignTable()" << oendl; |
427 | 427 | ||
428 | setPaintingEnabled( FALSE ); | 428 | setPaintingEnabled( FALSE ); |
429 | 429 | ||
430 | resizeRows(); | 430 | resizeRows(); |
431 | fitColumns(); | 431 | fitColumns(); |
432 | 432 | ||
433 | setPaintingEnabled( TRUE ); | 433 | setPaintingEnabled( TRUE ); |
434 | 434 | ||
435 | } | 435 | } |
436 | 436 | ||
437 | 437 | ||
438 | 438 | ||
439 | 439 | ||
440 | #if QT_VERSION <= 230 | 440 | #if QT_VERSION <= 230 |
441 | #ifndef SINGLE_APP | 441 | #ifndef SINGLE_APP |
442 | void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) | 442 | void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) |
443 | { | 443 | { |
444 | // Region of the rect we should draw | 444 | // Region of the rect we should draw |
445 | QRegion reg( QRect( cx, cy, cw, ch ) ); | 445 | QRegion reg( QRect( cx, cy, cw, ch ) ); |
446 | // Subtract the table from it | 446 | // Subtract the table from it |
447 | reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); | 447 | reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); |
448 | // And draw the rectangles (transformed as needed) | 448 | // And draw the rectangles (transformed as needed) |
449 | QArray<QRect> r = reg.rects(); | 449 | QArray<QRect> r = reg.rects(); |
450 | for (unsigned int i=0; i<r.count(); i++) | 450 | for (unsigned int i=0; i<r.count(); i++) |
451 | p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); | 451 | p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); |
452 | } | 452 | } |
453 | #endif | 453 | #endif |
454 | #endif | 454 | #endif |
455 | 455 | ||
456 | 456 | ||
457 | // int AbTable::rowHeight( int ) const | 457 | // int AbTable::rowHeight( int ) const |
458 | // { | 458 | // { |
459 | // return 18; | 459 | // return 18; |
460 | // } | 460 | // } |
461 | 461 | ||
462 | // int AbTable::rowPos( int row ) const | 462 | // int AbTable::rowPos( int row ) const |
463 | // { | 463 | // { |
464 | // return 18*row; | 464 | // return 18*row; |
465 | // } | 465 | // } |
466 | 466 | ||
467 | // int AbTable::rowAt( int pos ) const | 467 | // int AbTable::rowAt( int pos ) const |
468 | // { | 468 | // { |
469 | // return QMIN( pos/18, numRows()-1 ); | 469 | // return QMIN( pos/18, numRows()-1 ); |
470 | // } | 470 | // } |
471 | 471 | ||
472 | 472 | ||
473 | 473 | ||
474 | void AbTable::fitColumns() | 474 | void AbTable::fitColumns() |
475 | { | 475 | { |
476 | qWarning( "void AbTable::fitColumns()" ); | 476 | Opie::Core::owarn << "void AbTable::fitColumns()" << oendl; |
477 | int contentsWidth = visibleWidth() / 2; | 477 | int contentsWidth = visibleWidth() / 2; |
478 | // Fix to better value | 478 | // Fix to better value |
479 | // contentsWidth = 130; | 479 | // contentsWidth = 130; |
480 | 480 | ||
481 | setPaintingEnabled( FALSE ); | 481 | setPaintingEnabled( FALSE ); |
482 | 482 | ||
483 | if ( columnVisible == false ){ | 483 | if ( columnVisible == false ){ |
484 | showColumn(0); | 484 | showColumn(0); |
485 | columnVisible = true; | 485 | columnVisible = true; |
486 | } | 486 | } |
487 | 487 | ||
488 | //qWarning("Width: %d", contentsWidth); | 488 | //Opie::Core::owarn << "Width: " << contentsWidth << oendl; |
489 | 489 | ||
490 | setColumnWidth( 0, contentsWidth ); | 490 | setColumnWidth( 0, contentsWidth ); |
491 | adjustColumn(1); | 491 | adjustColumn(1); |
492 | if ( columnWidth(1) < contentsWidth ) | 492 | if ( columnWidth(1) < contentsWidth ) |
493 | setColumnWidth( 1, contentsWidth ); | 493 | setColumnWidth( 1, contentsWidth ); |
494 | 494 | ||
495 | setPaintingEnabled( TRUE ); | 495 | setPaintingEnabled( TRUE ); |
496 | } | 496 | } |
497 | 497 | ||
498 | void AbTable::show() | 498 | void AbTable::show() |
499 | { | 499 | { |
500 | //qWarning( "void AbTable::show()" ); | 500 | //Opie::Core::owarn << "void AbTable::show()" << oendl; |
501 | realignTable(); | 501 | realignTable(); |
502 | QTable::show(); | 502 | QTable::show(); |
503 | } | 503 | } |
504 | 504 | ||
505 | #if 0 | 505 | #if 0 |
506 | void AbTable::setChoiceNames( const QStringList& list) | 506 | void AbTable::setChoiceNames( const QStringList& list) |
507 | { | 507 | { |
508 | choicenames = list; | 508 | choicenames = list; |
509 | if ( choicenames.isEmpty() ) { | 509 | if ( choicenames.isEmpty() ) { |
510 | // hide pick column | 510 | // hide pick column |
511 | setNumCols( 2 ); | 511 | setNumCols( 2 ); |
512 | } else { | 512 | } else { |
513 | // show pick column | 513 | // show pick column |
514 | setNumCols( 3 ); | 514 | setNumCols( 3 ); |
515 | setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); | 515 | setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); |
516 | horizontalHeader()->setLabel( 2, tr( "Pick" )); | 516 | horizontalHeader()->setLabel( 2, tr( "Pick" )); |
517 | } | 517 | } |
518 | fitColumns(); | 518 | fitColumns(); |
519 | } | 519 | } |
520 | #endif | 520 | #endif |
521 | 521 | ||
522 | void AbTable::itemClicked(int,int col) | 522 | void AbTable::itemClicked(int,int col) |
523 | { | 523 | { |
524 | //qWarning( "AbTable::itemClicked(int, col:%d)", col); | 524 | //Opie::Core::owarn << "AbTable::itemClicked(int, col: " << col << ")" << oendl; |
525 | if ( col == 2 ) { | 525 | if ( col == 2 ) { |
526 | return; | 526 | return; |
527 | } else { | 527 | } else { |
528 | // qWarning ("Emitting signalSwitch()"); | 528 | //Opie::Core::owarn << "Emitting signalSwitch()" << oendl; |
529 | emit signalSwitch(); | 529 | emit signalSwitch(); |
530 | } | 530 | } |
531 | } | 531 | } |
532 | 532 | ||
533 | #if 0 | 533 | #if 0 |
534 | QStringList AbTable::choiceNames() const | 534 | QStringList AbTable::choiceNames() const |
535 | { | 535 | { |
536 | return choicenames; | 536 | return choicenames; |
537 | } | 537 | } |
538 | 538 | ||
539 | #endif | 539 | #endif |
540 | void AbTable::setChoiceSelection( const QValueList<int>& list ) | 540 | void AbTable::setChoiceSelection( const QValueList<int>& list ) |
541 | { | 541 | { |
542 | intFields = list; | 542 | intFields = list; |
543 | } | 543 | } |
544 | 544 | ||
545 | QStringList AbTable::choiceSelection(int /*index*/) const | 545 | QStringList AbTable::choiceSelection(int /*index*/) const |
546 | { | 546 | { |
547 | QStringList r; | 547 | QStringList r; |
548 | /* ###### | 548 | /* ###### |
549 | 549 | ||
550 | QString selname = choicenames.at(index); | 550 | QString selname = choicenames.at(index); |
551 | for (each row) { | 551 | for (each row) { |
552 | Opie::OPimContact *c = contactForRow(row); | 552 | Opie::OPimContact *c = contactForRow(row); |
553 | if ( text(row,2) == selname ) { | 553 | if ( text(row,2) == selname ) { |
554 | r.append(c->email); | 554 | r.append(c->email); |
555 | } | 555 | } |
556 | } | 556 | } |
557 | 557 | ||
558 | */ | 558 | */ |
559 | return r; | 559 | return r; |
560 | } | 560 | } |
561 | 561 | ||
562 | 562 | ||
563 | void AbTable::updateVisible() | 563 | void AbTable::updateVisible() |
564 | { | 564 | { |
565 | //qWarning("void AbTable::updateVisible()"); | 565 | //Opie::Core::owarn << "void AbTable::updateVisible()" << oendl; |
566 | 566 | ||
567 | int visible, | 567 | int visible, |
568 | totalRows, | 568 | totalRows, |
569 | row, | 569 | row, |
570 | selectedRow = 0; | 570 | selectedRow = 0; |
571 | 571 | ||
572 | visible = 0; | 572 | visible = 0; |
573 | 573 | ||
574 | setPaintingEnabled( FALSE ); | 574 | setPaintingEnabled( FALSE ); |
575 | 575 | ||
576 | realignTable(); | 576 | realignTable(); |
577 | 577 | ||
578 | totalRows = numRows(); | 578 | totalRows = numRows(); |
579 | for ( row = 0; row < totalRows; row++ ) { | 579 | for ( row = 0; row < totalRows; row++ ) { |
580 | if ( rowHeight(row) == 0 ) { | 580 | if ( rowHeight(row) == 0 ) { |
581 | showRow( row ); | 581 | showRow( row ); |
582 | adjustRow( row ); | 582 | adjustRow( row ); |
583 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) | 583 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) |
584 | selectedRow = row; | 584 | selectedRow = row; |
585 | } | 585 | } |
586 | visible++; | 586 | visible++; |
587 | } | 587 | } |
588 | 588 | ||
589 | if ( selectedRow ) | 589 | if ( selectedRow ) |
590 | setCurrentCell( selectedRow, 0 ); | 590 | setCurrentCell( selectedRow, 0 ); |
591 | 591 | ||
592 | if ( !visible ) | 592 | if ( !visible ) |
593 | setCurrentCell( -1, 0 ); | 593 | setCurrentCell( -1, 0 ); |
594 | 594 | ||
595 | setPaintingEnabled( TRUE ); | 595 | setPaintingEnabled( TRUE ); |
596 | } | 596 | } |
597 | 597 | ||
598 | 598 | ||
599 | void AbTable::setPaintingEnabled( bool e ) | 599 | void AbTable::setPaintingEnabled( bool e ) |
600 | { | 600 | { |
601 | //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); | 601 | //Opie::Core::owarn << "IN void AbTable::setPaintingEnabled( " << e << " )->Nested: " |
602 | // << countNested << oendl; | ||
602 | 603 | ||
603 | if ( e ) { | 604 | if ( e ) { |
604 | if ( countNested > 0 ) | 605 | if ( countNested > 0 ) |
605 | --countNested; | 606 | --countNested; |
606 | if ( ! countNested ){ | 607 | if ( ! countNested ){ |
607 | setUpdatesEnabled( true ); | 608 | setUpdatesEnabled( true ); |
608 | enablePainting = true; | 609 | enablePainting = true; |
609 | rowHeightChanged( 0 ); | 610 | rowHeightChanged( 0 ); |
610 | viewport()->update(); | 611 | viewport()->update(); |
611 | } | 612 | } |
612 | } else { | 613 | } else { |
613 | ++countNested; | 614 | ++countNested; |
614 | enablePainting = false; | 615 | enablePainting = false; |
615 | setUpdatesEnabled( false ); | 616 | setUpdatesEnabled( false ); |
616 | } | 617 | } |
617 | //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); | 618 | //Opie::Core::owarn << "OUT void AbTable::setPaintingEnabled( " << e << " )->Nested: " |
619 | // << countNested << oendl; | ||
618 | } | 620 | } |
619 | 621 | ||
620 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { | 622 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { |
621 | //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); | 623 | //Opie::Core::owarn << "void AbTable::viewportPaintEvent( QPaintEvent* e ) -> " |
624 | // << enablePainting << oendl; | ||
622 | if ( enablePainting ) | 625 | if ( enablePainting ) |
623 | QTable::viewportPaintEvent( e ); | 626 | QTable::viewportPaintEvent( e ); |
624 | } | 627 | } |
625 | 628 | ||
626 | void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { | 629 | void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { |
627 | const QColorGroup &cg = colorGroup(); | 630 | const QColorGroup &cg = colorGroup(); |
628 | 631 | ||
629 | p->save(); | 632 | p->save(); |
630 | 633 | ||
631 | //qWarning( "Paint row: %d", row ); | 634 | //Opie::Core::owarn << "Paint row: " << row << oendl; |
632 | 635 | ||
633 | Opie::OPimContact act_contact = m_viewList[row]; | 636 | Opie::OPimContact act_contact = m_viewList[row]; |
634 | 637 | ||
635 | // Paint alternating background bars | 638 | // Paint alternating background bars |
636 | if ( (row % 2 ) == 0 ) { | 639 | if ( (row % 2 ) == 0 ) { |
637 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | 640 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); |
638 | p->setPen( QPen( cg.text() ) ); | 641 | p->setPen( QPen( cg.text() ) ); |
639 | } | 642 | } |
640 | else { | 643 | else { |
641 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); | 644 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); |
642 | p->setPen( QPen( cg.buttonText() ) ); | 645 | p->setPen( QPen( cg.buttonText() ) ); |
643 | } | 646 | } |
644 | 647 | ||
645 | QFont f = p->font(); | 648 | QFont f = p->font(); |
646 | QFontMetrics fm(f); | 649 | QFontMetrics fm(f); |
647 | 650 | ||
648 | int marg = 2; | 651 | int marg = 2; |
649 | int x = 0; | 652 | int x = 0; |
650 | int y = ( cr.height() - 14 ) / 2; | 653 | int y = ( cr.height() - 14 ) / 2; |
651 | 654 | ||
652 | QString nameText = act_contact.fileAs(); | 655 | QString nameText = act_contact.fileAs(); |
653 | 656 | ||
654 | switch( col ){ | 657 | switch( col ){ |
655 | case 0: | 658 | case 0: |
656 | p->drawText( x + marg,2 + fm.ascent(), nameText ); | 659 | p->drawText( x + marg,2 + fm.ascent(), nameText ); |
657 | break; | 660 | break; |
658 | case 1:{ | 661 | case 1:{ |
659 | 662 | ||
660 | ContactItem contactItem = findContactContact( act_contact, 0 ); | 663 | ContactItem contactItem = findContactContact( act_contact, 0 ); |
661 | QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ | 664 | QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ |
662 | QString contactText = contactItem.value; | 665 | QString contactText = contactItem.value; |
663 | 666 | ||
664 | if ( !contactPic.isNull() ) | 667 | if ( !contactPic.isNull() ) |
665 | { | 668 | { |
666 | p->drawPixmap( x + marg, y, contactPic ); | 669 | p->drawPixmap( x + marg, y, contactPic ); |
667 | p->drawText( x + marg + contactPic.width() | 670 | p->drawText( x + marg + contactPic.width() |
668 | + 4,2 + fm.ascent(), contactText ); | 671 | + 4,2 + fm.ascent(), contactText ); |
669 | } | 672 | } |
670 | else | 673 | else |
671 | { | 674 | { |
672 | p->drawText( x + marg,2 + fm.ascent(), contactText ); | 675 | p->drawText( x + marg,2 + fm.ascent(), contactText ); |
673 | } | 676 | } |
674 | } | 677 | } |
675 | break; | 678 | break; |
676 | 679 | ||
677 | } | 680 | } |
678 | p->restore(); | 681 | p->restore(); |
679 | } | 682 | } |
680 | 683 | ||
681 | void AbTable::rowHeightChanged( int row ) | 684 | void AbTable::rowHeightChanged( int row ) |
682 | { | 685 | { |
683 | if ( enablePainting ) | 686 | if ( enablePainting ) |
684 | QTable::rowHeightChanged( row ); | 687 | QTable::rowHeightChanged( row ); |
685 | } | 688 | } |
686 | ContactItem AbTable::findContactContact( const Opie::OPimContact &entry, int /* row */ ) | 689 | ContactItem AbTable::findContactContact( const Opie::OPimContact &entry, int /* row */ ) |
687 | { | 690 | { |
688 | 691 | ||
689 | ContactItem item; | 692 | ContactItem item; |
690 | 693 | ||
691 | item.value = ""; | 694 | item.value = ""; |
692 | 695 | ||
693 | for ( QValueList<int>::ConstIterator it = intFields.begin(); | 696 | for ( QValueList<int>::ConstIterator it = intFields.begin(); |
694 | it != intFields.end(); ++it ) { | 697 | it != intFields.end(); ++it ) { |
695 | switch ( *it ) { | 698 | switch ( *it ) { |
696 | default: | 699 | default: |
697 | break; | 700 | break; |
698 | case Qtopia::Title: | 701 | case Qtopia::Title: |
699 | item.value = entry.title(); | 702 | item.value = entry.title(); |
700 | break; | 703 | break; |
701 | case Qtopia::Suffix: | 704 | case Qtopia::Suffix: |
702 | item.value = entry.suffix(); | 705 | item.value = entry.suffix(); |
703 | break; | 706 | break; |
704 | case Qtopia::FileAs: | 707 | case Qtopia::FileAs: |
705 | item.value = entry.fileAs(); | 708 | item.value = entry.fileAs(); |
706 | break; | 709 | break; |
707 | case Qtopia::DefaultEmail: | 710 | case Qtopia::DefaultEmail: |
708 | item.value = entry.defaultEmail(); | 711 | item.value = entry.defaultEmail(); |
709 | if ( !item.value.isEmpty() ) | 712 | if ( !item.value.isEmpty() ) |
710 | item.icon = Resource::loadPixmap( "addressbook/email" ); | 713 | item.icon = Resource::loadPixmap( "addressbook/email" ); |
711 | break; | 714 | break; |
712 | case Qtopia::Emails: | 715 | case Qtopia::Emails: |
713 | item.value = entry.emails(); | 716 | item.value = entry.emails(); |
714 | if ( !item.value.isEmpty() ) | 717 | if ( !item.value.isEmpty() ) |
715 | item.icon = Resource::loadPixmap( "addressbook/email" ); | 718 | item.icon = Resource::loadPixmap( "addressbook/email" ); |
716 | break; | 719 | break; |
717 | case Qtopia::HomeStreet: | 720 | case Qtopia::HomeStreet: |
718 | item.value = entry.homeStreet(); | 721 | item.value = entry.homeStreet(); |
719 | break; | 722 | break; |
720 | case Qtopia::HomeCity: | 723 | case Qtopia::HomeCity: |
721 | item.value = entry.homeCity(); | 724 | item.value = entry.homeCity(); |
722 | break; | 725 | break; |
723 | case Qtopia::HomeState: | 726 | case Qtopia::HomeState: |
724 | item.value = entry.homeState(); | 727 | item.value = entry.homeState(); |
725 | break; | 728 | break; |
726 | case Qtopia::HomeZip: | 729 | case Qtopia::HomeZip: |
727 | item.value = entry.homeZip(); | 730 | item.value = entry.homeZip(); |
728 | break; | 731 | break; |
729 | case Qtopia::HomeCountry: | 732 | case Qtopia::HomeCountry: |
730 | item.value = entry.homeCountry(); | 733 | item.value = entry.homeCountry(); |
731 | break; | 734 | break; |
732 | case Qtopia::HomePhone: | 735 | case Qtopia::HomePhone: |
733 | item.value = entry.homePhone(); | 736 | item.value = entry.homePhone(); |
734 | if ( !item.value.isEmpty() ) | 737 | if ( !item.value.isEmpty() ) |
735 | item.icon = Resource::loadPixmap( "addressbook/phonehome" ); | 738 | item.icon = Resource::loadPixmap( "addressbook/phonehome" ); |
736 | break; | 739 | break; |
737 | case Qtopia::HomeFax: | 740 | case Qtopia::HomeFax: |
738 | item.value = entry.homeFax(); | 741 | item.value = entry.homeFax(); |
739 | if ( !item.value.isEmpty() ) | 742 | if ( !item.value.isEmpty() ) |
740 | item.icon = Resource::loadPixmap( "addressbook/faxhome" ); | 743 | item.icon = Resource::loadPixmap( "addressbook/faxhome" ); |
741 | break; | 744 | break; |
742 | case Qtopia::HomeMobile: | 745 | case Qtopia::HomeMobile: |
743 | item.value = entry.homeMobile(); | 746 | item.value = entry.homeMobile(); |
744 | if ( !item.value.isEmpty() ) | 747 | if ( !item.value.isEmpty() ) |
745 | item.icon = Resource::loadPixmap( "addressbook/mobilehome" ); | 748 | item.icon = Resource::loadPixmap( "addressbook/mobilehome" ); |
746 | break; | 749 | break; |
747 | case Qtopia::HomeWebPage: | 750 | case Qtopia::HomeWebPage: |
748 | item.value = entry.homeWebpage(); | 751 | item.value = entry.homeWebpage(); |
749 | if ( !item.value.isEmpty() ) | 752 | if ( !item.value.isEmpty() ) |
750 | item.icon = Resource::loadPixmap( "addressbook/webpagehome" ); | 753 | item.icon = Resource::loadPixmap( "addressbook/webpagehome" ); |
751 | break; | 754 | break; |
752 | case Qtopia::Company: | 755 | case Qtopia::Company: |
753 | item.value = entry.company(); | 756 | item.value = entry.company(); |
754 | break; | 757 | break; |
755 | case Qtopia::BusinessCity: | 758 | case Qtopia::BusinessCity: |
756 | item.value = entry.businessCity(); | 759 | item.value = entry.businessCity(); |
757 | break; | 760 | break; |
758 | case Qtopia::BusinessStreet: | 761 | case Qtopia::BusinessStreet: |
759 | item.value = entry.businessStreet(); | 762 | item.value = entry.businessStreet(); |
760 | break; | 763 | break; |
761 | case Qtopia::BusinessZip: | 764 | case Qtopia::BusinessZip: |
762 | item.value = entry.businessZip(); | 765 | item.value = entry.businessZip(); |
763 | break; | 766 | break; |
764 | case Qtopia::BusinessCountry: | 767 | case Qtopia::BusinessCountry: |
765 | item.value = entry.businessCountry(); | 768 | item.value = entry.businessCountry(); |
766 | break; | 769 | break; |
767 | case Qtopia::BusinessWebPage: | 770 | case Qtopia::BusinessWebPage: |
768 | item.value = entry.businessWebpage(); | 771 | item.value = entry.businessWebpage(); |
769 | if ( !item.value.isEmpty() ) | 772 | if ( !item.value.isEmpty() ) |
770 | item.icon = Resource::loadPixmap( "addressbook/webpagework" ); | 773 | item.icon = Resource::loadPixmap( "addressbook/webpagework" ); |
771 | break; | 774 | break; |
772 | case Qtopia::JobTitle: | 775 | case Qtopia::JobTitle: |
773 | item.value = entry.jobTitle(); | 776 | item.value = entry.jobTitle(); |
774 | break; | 777 | break; |
775 | case Qtopia::Department: | 778 | case Qtopia::Department: |
776 | item.value = entry.department(); | 779 | item.value = entry.department(); |
777 | break; | 780 | break; |
778 | case Qtopia::Office: | 781 | case Qtopia::Office: |
779 | item.value = entry.office(); | 782 | item.value = entry.office(); |
780 | break; | 783 | break; |
781 | case Qtopia::BusinessPhone: | 784 | case Qtopia::BusinessPhone: |
782 | item.value = entry.businessPhone(); | 785 | item.value = entry.businessPhone(); |
783 | if ( !item.value.isEmpty() ) | 786 | if ( !item.value.isEmpty() ) |
784 | item.icon = Resource::loadPixmap( "addressbook/phonework" ); | 787 | item.icon = Resource::loadPixmap( "addressbook/phonework" ); |
785 | break; | 788 | break; |
786 | case Qtopia::BusinessFax: | 789 | case Qtopia::BusinessFax: |
787 | item.value = entry.businessFax(); | 790 | item.value = entry.businessFax(); |
788 | if ( !item.value.isEmpty() ) | 791 | if ( !item.value.isEmpty() ) |
789 | item.icon = Resource::loadPixmap( "addressbook/faxwork" ); | 792 | item.icon = Resource::loadPixmap( "addressbook/faxwork" ); |
790 | break; | 793 | break; |
791 | case Qtopia::BusinessMobile: | 794 | case Qtopia::BusinessMobile: |
792 | item.value = entry.businessMobile(); | 795 | item.value = entry.businessMobile(); |
793 | if ( !item.value.isEmpty() ) | 796 | if ( !item.value.isEmpty() ) |
794 | item.icon = Resource::loadPixmap( "addressbook/mobilework" ); | 797 | item.icon = Resource::loadPixmap( "addressbook/mobilework" ); |
795 | break; | 798 | break; |
796 | case Qtopia::BusinessPager: | 799 | case Qtopia::BusinessPager: |
797 | item.value = entry.businessPager(); | 800 | item.value = entry.businessPager(); |
798 | break; | 801 | break; |
799 | case Qtopia::Profession: | 802 | case Qtopia::Profession: |
800 | item.value = entry.profession(); | 803 | item.value = entry.profession(); |
801 | break; | 804 | break; |
802 | case Qtopia::Assistant: | 805 | case Qtopia::Assistant: |
803 | item.value = entry.assistant(); | 806 | item.value = entry.assistant(); |
804 | break; | 807 | break; |
805 | case Qtopia::Manager: | 808 | case Qtopia::Manager: |
806 | item.value = entry.manager(); | 809 | item.value = entry.manager(); |
807 | break; | 810 | break; |
808 | case Qtopia::Spouse: | 811 | case Qtopia::Spouse: |
809 | item.value = entry.spouse(); | 812 | item.value = entry.spouse(); |
810 | break; | 813 | break; |
811 | case Qtopia::Gender: | 814 | case Qtopia::Gender: |
812 | item.value = entry.gender(); | 815 | item.value = entry.gender(); |
813 | break; | 816 | break; |
814 | case Qtopia::Birthday: | 817 | case Qtopia::Birthday: |
815 | if ( ! entry.birthday().isNull() ){ | 818 | if ( ! entry.birthday().isNull() ){ |
816 | item.value = TimeString::numberDateString( entry.birthday() ); | 819 | item.value = TimeString::numberDateString( entry.birthday() ); |
817 | } | 820 | } |
818 | break; | 821 | break; |
819 | case Qtopia::Anniversary: | 822 | case Qtopia::Anniversary: |
820 | if ( ! entry.anniversary().isNull() ){ | 823 | if ( ! entry.anniversary().isNull() ){ |
821 | item.value = TimeString::numberDateString( entry.anniversary() ); | 824 | item.value = TimeString::numberDateString( entry.anniversary() ); |
822 | } | 825 | } |
823 | break; | 826 | break; |
824 | case Qtopia::Nickname: | 827 | case Qtopia::Nickname: |
825 | item.value = entry.nickname(); | 828 | item.value = entry.nickname(); |
826 | break; | 829 | break; |
827 | case Qtopia::Children: | 830 | case Qtopia::Children: |
828 | item.value = entry.children(); | 831 | item.value = entry.children(); |
829 | break; | 832 | break; |
830 | case Qtopia::Notes: | 833 | case Qtopia::Notes: |
831 | item.value = entry.notes(); | 834 | item.value = entry.notes(); |
832 | break; | 835 | break; |
833 | } | 836 | } |
834 | if ( !item.value.isEmpty() ) | 837 | if ( !item.value.isEmpty() ) |
835 | break; | 838 | break; |
836 | } | 839 | } |
837 | return item; | 840 | return item; |
838 | } | 841 | } |
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index aa242b7..52e5f59 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp | |||
@@ -1,506 +1,509 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) | 2 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) |
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 | ** | 14 | ** |
15 | **********************************************************************/ | 15 | **********************************************************************/ |
16 | 16 | ||
17 | #include "abview.h" | 17 | #include "abview.h" |
18 | 18 | ||
19 | #include <opie2/ocontactaccessbackend_vcard.h> | 19 | #include <opie2/ocontactaccessbackend_vcard.h> |
20 | #include <opie2/odebug.h> | ||
20 | 21 | ||
21 | #include <qpe/global.h> | 22 | #include <qpe/global.h> |
22 | 23 | ||
23 | #include <qlayout.h> | 24 | #include <qlayout.h> |
24 | 25 | ||
25 | #include <assert.h> | 26 | #include <assert.h> |
26 | 27 | ||
27 | 28 | ||
28 | // Is defined in LibQPE | 29 | // Is defined in LibQPE |
29 | extern QString categoryFileName(); | 30 | extern QString categoryFileName(); |
30 | 31 | ||
31 | QString addressbookPersonalVCardName() | 32 | QString addressbookPersonalVCardName() |
32 | { | 33 | { |
33 | QString filename = Global::applicationFileName("addressbook", | 34 | QString filename = Global::applicationFileName("addressbook", |
34 | "businesscard.vcf"); | 35 | "businesscard.vcf"); |
35 | return filename; | 36 | return filename; |
36 | } | 37 | } |
37 | 38 | ||
38 | 39 | ||
39 | AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): | 40 | AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): |
40 | QWidget(parent), | 41 | QWidget(parent), |
41 | mCat(0), | 42 | mCat(0), |
42 | m_inSearch( false ), | 43 | m_inSearch( false ), |
43 | m_inPersonal( false ), | 44 | m_inPersonal( false ), |
44 | m_curr_category( -1 ), | 45 | m_curr_category( -1 ), |
45 | m_curr_View( TableView ), | 46 | m_curr_View( TableView ), |
46 | m_prev_View( TableView ), | 47 | m_prev_View( TableView ), |
47 | m_curr_Contact ( 0 ), | 48 | m_curr_Contact ( 0 ), |
48 | m_contactdb ( 0l ), | 49 | m_contactdb ( 0l ), |
49 | m_storedDB ( 0l ), | 50 | m_storedDB ( 0l ), |
50 | m_viewStack( 0l ), | 51 | m_viewStack( 0l ), |
51 | m_abTable( 0l ), | 52 | m_abTable( 0l ), |
52 | m_orderedFields( ordered ) | 53 | m_orderedFields( ordered ) |
53 | { | 54 | { |
54 | qWarning("AbView::c'tor"); | 55 | Opie::Core::owarn << "AbView::c'tor" << oendl; |
55 | // Load default database and handle syncing myself.. ! | 56 | // Load default database and handle syncing myself.. ! |
56 | m_contactdb = new Opie::OPimContactAccess ( "addressbook", 0l, 0l, false ); | 57 | m_contactdb = new Opie::OPimContactAccess ( "addressbook", 0l, 0l, false ); |
57 | m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available | 58 | m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available |
58 | mCat.load( categoryFileName() ); | 59 | mCat.load( categoryFileName() ); |
59 | 60 | ||
60 | // Create Layout and put WidgetStack into it. | 61 | // Create Layout and put WidgetStack into it. |
61 | QVBoxLayout *vb = new QVBoxLayout( this ); | 62 | QVBoxLayout *vb = new QVBoxLayout( this ); |
62 | m_viewStack = new QWidgetStack( this ); | 63 | m_viewStack = new QWidgetStack( this ); |
63 | vb->addWidget( m_viewStack ); | 64 | vb->addWidget( m_viewStack ); |
64 | 65 | ||
65 | // Creat TableView | 66 | // Creat TableView |
66 | QVBox* tableBox = new QVBox( m_viewStack ); | 67 | QVBox* tableBox = new QVBox( m_viewStack ); |
67 | m_abTable = new AbTable( m_orderedFields, tableBox, "table" ); | 68 | m_abTable = new AbTable( m_orderedFields, tableBox, "table" ); |
68 | m_abTable->setCurrentCell( 0, 0 ); | 69 | m_abTable->setCurrentCell( 0, 0 ); |
69 | m_abTable->setFocus(); | 70 | m_abTable->setFocus(); |
70 | 71 | ||
71 | // Add TableView to WidgetStack and raise it | 72 | // Add TableView to WidgetStack and raise it |
72 | m_viewStack -> addWidget( tableBox , TableView ); | 73 | m_viewStack -> addWidget( tableBox , TableView ); |
73 | 74 | ||
74 | // Create CardView and add it to WidgetStack | 75 | // Create CardView and add it to WidgetStack |
75 | QVBox* cardBox = new QVBox( m_viewStack ); | 76 | QVBox* cardBox = new QVBox( m_viewStack ); |
76 | m_ablabel = new AbLabel( cardBox, "CardView"); | 77 | m_ablabel = new AbLabel( cardBox, "CardView"); |
77 | m_viewStack -> addWidget( cardBox , CardView ); | 78 | m_viewStack -> addWidget( cardBox , CardView ); |
78 | 79 | ||
79 | // Connect views to me | 80 | // Connect views to me |
80 | connect ( m_abTable, SIGNAL( signalSwitch(void) ), | 81 | connect ( m_abTable, SIGNAL( signalSwitch(void) ), |
81 | this, SLOT( slotSwitch(void) ) ); | 82 | this, SLOT( slotSwitch(void) ) ); |
82 | connect ( m_ablabel, SIGNAL( signalOkPressed(void) ), | 83 | connect ( m_ablabel, SIGNAL( signalOkPressed(void) ), |
83 | this, SLOT( slotSwitch(void) ) ); | 84 | this, SLOT( slotSwitch(void) ) ); |
84 | 85 | ||
85 | load(); | 86 | load(); |
86 | } | 87 | } |
87 | 88 | ||
88 | AbView::~AbView() | 89 | AbView::~AbView() |
89 | { | 90 | { |
90 | m_contactdb -> save(); | 91 | m_contactdb -> save(); |
91 | delete m_contactdb; | 92 | delete m_contactdb; |
92 | 93 | ||
93 | if ( m_storedDB ){ | 94 | if ( m_storedDB ){ |
94 | m_storedDB -> save(); | 95 | m_storedDB -> save(); |
95 | delete m_storedDB; | 96 | delete m_storedDB; |
96 | } | 97 | } |
97 | } | 98 | } |
98 | 99 | ||
99 | 100 | ||
100 | void AbView::setView( Views view ) | 101 | void AbView::setView( Views view ) |
101 | { | 102 | { |
102 | qWarning("AbView::setView( Views view )"); | 103 | Opie::Core::owarn << "AbView::setView( Views view )" << oendl; |
103 | m_curr_View = view; | 104 | m_curr_View = view; |
104 | load(); | 105 | load(); |
105 | } | 106 | } |
106 | 107 | ||
107 | void AbView::addEntry( const Opie::OPimContact &newContact ) | 108 | void AbView::addEntry( const Opie::OPimContact &newContact ) |
108 | { | 109 | { |
109 | qWarning("abview:AddContact"); | 110 | Opie::Core::owarn << "AbView::AddContact" << oendl; |
110 | m_contactdb->add ( newContact ); | 111 | m_contactdb->add ( newContact ); |
111 | load(); | 112 | load(); |
112 | 113 | ||
113 | } | 114 | } |
114 | void AbView::removeEntry( const int UID ) | 115 | void AbView::removeEntry( const int UID ) |
115 | { | 116 | { |
116 | qWarning("abview:RemoveContact"); | 117 | Opie::Core::owarn << "AbView;:RemoveContact" << oendl; |
117 | m_contactdb->remove( UID ); | 118 | m_contactdb->remove( UID ); |
118 | load(); | 119 | load(); |
119 | } | 120 | } |
120 | 121 | ||
121 | void AbView::replaceEntry( const Opie::OPimContact &contact ) | 122 | void AbView::replaceEntry( const Opie::OPimContact &contact ) |
122 | { | 123 | { |
123 | qWarning("abview:ReplaceContact"); | 124 | Opie::Core::owarn << "AbView::ReplaceContact" << oendl; |
124 | m_contactdb->replace( contact ); | 125 | m_contactdb->replace( contact ); |
125 | load(); | 126 | load(); |
126 | 127 | ||
127 | } | 128 | } |
128 | 129 | ||
129 | Opie::OPimContact AbView::currentEntry() | 130 | Opie::OPimContact AbView::currentEntry() |
130 | { | 131 | { |
131 | Opie::OPimContact currentContact; | 132 | Opie::OPimContact currentContact; |
132 | 133 | ||
133 | switch ( (int) m_curr_View ) { | 134 | switch ( (int) m_curr_View ) { |
134 | case TableView: | 135 | case TableView: |
135 | currentContact = m_abTable -> currentEntry(); | 136 | currentContact = m_abTable -> currentEntry(); |
136 | break; | 137 | break; |
137 | case CardView: | 138 | case CardView: |
138 | currentContact = m_ablabel -> currentEntry(); | 139 | currentContact = m_ablabel -> currentEntry(); |
139 | break; | 140 | break; |
140 | } | 141 | } |
141 | m_curr_Contact = currentContact.uid(); | 142 | m_curr_Contact = currentContact.uid(); |
142 | return currentContact; | 143 | return currentContact; |
143 | } | 144 | } |
144 | 145 | ||
145 | bool AbView::save() | 146 | bool AbView::save() |
146 | { | 147 | { |
147 | //qWarning("abView:Save data"); | 148 | //Opie::Core::owarn << "AbView::Save data" << oendl; |
148 | 149 | ||
149 | return m_contactdb->save(); | 150 | return m_contactdb->save(); |
150 | } | 151 | } |
151 | 152 | ||
152 | void AbView::load() | 153 | void AbView::load() |
153 | { | 154 | { |
154 | qWarning("abView:Load data"); | 155 | Opie::Core::owarn << "AbView::Load data" << oendl; |
155 | 156 | ||
156 | // Letter Search is stopped at this place | 157 | // Letter Search is stopped at this place |
157 | emit signalClearLetterPicker(); | 158 | emit signalClearLetterPicker(); |
158 | 159 | ||
159 | if ( m_inPersonal ) | 160 | if ( m_inPersonal ) |
160 | // VCard Backend does not sort.. | 161 | // VCard Backend does not sort.. |
161 | m_list = m_contactdb->allRecords(); | 162 | m_list = m_contactdb->allRecords(); |
162 | else{ | 163 | else{ |
163 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); | 164 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); |
164 | if ( m_curr_category != -1 ) | 165 | if ( m_curr_category != -1 ) |
165 | clearForCategory(); | 166 | clearForCategory(); |
166 | } | 167 | } |
167 | 168 | ||
168 | qWarning ("Number of contacts: %d", m_list.count()); | 169 | Opie::Core::owarn << "Number of contacts: " << m_list.count() << oendl; |
169 | 170 | ||
170 | updateView( true ); | 171 | updateView( true ); |
171 | 172 | ||
172 | } | 173 | } |
173 | 174 | ||
174 | void AbView::reload() | 175 | void AbView::reload() |
175 | { | 176 | { |
176 | qWarning( "void AbView::reload()" ); | 177 | Opie::Core::owarn << "AbView::::reload()" << oendl; |
177 | 178 | ||
178 | m_contactdb->reload(); | 179 | m_contactdb->reload(); |
179 | load(); | 180 | load(); |
180 | } | 181 | } |
181 | 182 | ||
182 | void AbView::clear() | 183 | void AbView::clear() |
183 | { | 184 | { |
184 | // :SX | 185 | // :SX |
185 | } | 186 | } |
186 | 187 | ||
187 | void AbView::setShowByCategory( const QString& cat ) | 188 | void AbView::setShowByCategory( const QString& cat ) |
188 | { | 189 | { |
189 | qWarning("AbView::setShowCategory( const QString& cat )"); | 190 | Opie::Core::owarn << "AbView::setShowCategory( const QString& cat )" << oendl; |
190 | 191 | ||
191 | int intCat = 0; | 192 | int intCat = 0; |
192 | 193 | ||
193 | // All (cat == NULL) will be stored as -1 | 194 | // All (cat == NULL) will be stored as -1 |
194 | if ( cat.isNull() ) | 195 | if ( cat.isNull() ) |
195 | intCat = -1; | 196 | intCat = -1; |
196 | else | 197 | else |
197 | intCat = mCat.id("Contacts", cat ); | 198 | intCat = mCat.id("Contacts", cat ); |
198 | 199 | ||
199 | // Just do anything if we really change the category | 200 | // Just do anything if we really change the category |
200 | if ( intCat != m_curr_category ){ | 201 | if ( intCat != m_curr_category ){ |
201 | // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); | 202 | // Opie::Core::owarn << "Categories: Selected " << cat << ".. Number: " |
203 | // << m_curr_category << oendl; | ||
202 | 204 | ||
203 | m_curr_category = intCat; | 205 | m_curr_category = intCat; |
204 | emit signalClearLetterPicker(); | 206 | emit signalClearLetterPicker(); |
205 | 207 | ||
206 | load(); | 208 | load(); |
207 | } | 209 | } |
208 | 210 | ||
209 | } | 211 | } |
210 | 212 | ||
211 | void AbView::setShowToView( Views view ) | 213 | void AbView::setShowToView( Views view ) |
212 | { | 214 | { |
213 | qWarning("void AbView::setShowToView( View %d )", view); | 215 | Opie::Core::owarn << "void AbView::setShowToView( View " << view << " )" << oendl; |
214 | 216 | ||
215 | if ( m_curr_View != view ){ | 217 | if ( m_curr_View != view ){ |
216 | qWarning ("Change the View (Category is: %d)", m_curr_category); | 218 | Opie::Core::owarn << "Change the View (Category is: " << m_curr_category << ")" << oendl; |
217 | m_prev_View = m_curr_View; | 219 | m_prev_View = m_curr_View; |
218 | m_curr_View = view; | 220 | m_curr_View = view; |
219 | 221 | ||
220 | updateView(); | 222 | updateView(); |
221 | } | 223 | } |
222 | 224 | ||
223 | } | 225 | } |
224 | 226 | ||
225 | void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) | 227 | void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) |
226 | { | 228 | { |
227 | qWarning("void AbView::setShowByLetter( %c, %d )", c, mode ); | 229 | Opie::Core::owarn << "void AbView::setShowByLetter( " << c << ", " << mode << " )" << oendl; |
228 | 230 | ||
229 | assert( mode < AbConfig::LASTELEMENT ); | 231 | assert( mode < AbConfig::LASTELEMENT ); |
230 | 232 | ||
231 | Opie::OPimContact query; | 233 | Opie::OPimContact query; |
232 | if ( c == 0 ){ | 234 | if ( c == 0 ){ |
233 | load(); | 235 | load(); |
234 | return; | 236 | return; |
235 | }else{ | 237 | }else{ |
236 | // If the current Backend is unable to solve the query, we will | 238 | // If the current Backend is unable to solve the query, we will |
237 | // ignore the request .. | 239 | // ignore the request .. |
238 | if ( ! m_contactdb->hasQuerySettings( Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ) ){ | 240 | if ( ! m_contactdb->hasQuerySettings( Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ) ){ |
239 | return; | 241 | return; |
240 | } | 242 | } |
241 | 243 | ||
242 | switch( mode ){ | 244 | switch( mode ){ |
243 | case AbConfig::LastName: | 245 | case AbConfig::LastName: |
244 | query.setLastName( QString("%1*").arg(c) ); | 246 | query.setLastName( QString("%1*").arg(c) ); |
245 | break; | 247 | break; |
246 | case AbConfig::FileAs: | 248 | case AbConfig::FileAs: |
247 | query.setFileAs( QString("%1*").arg(c) ); | 249 | query.setFileAs( QString("%1*").arg(c) ); |
248 | break; | 250 | break; |
249 | default: | 251 | default: |
250 | qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode ); | 252 | Opie::Core::owarn << "Unknown Searchmode for AbView::setShowByLetter ! -> " << mode << oendl |
251 | qWarning( "I will ignore it.." ); | 253 | << "I will ignore it.." << oendl; |
252 | return; | 254 | return; |
253 | } | 255 | } |
254 | m_list = m_contactdb->queryByExample( query, Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ); | 256 | m_list = m_contactdb->queryByExample( query, Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ); |
255 | if ( m_curr_category != -1 ) | 257 | if ( m_curr_category != -1 ) |
256 | clearForCategory(); | 258 | clearForCategory(); |
257 | m_curr_Contact = 0; | 259 | m_curr_Contact = 0; |
258 | } | 260 | } |
259 | updateView( true ); | 261 | updateView( true ); |
260 | } | 262 | } |
261 | 263 | ||
262 | void AbView::setListOrder( const QValueList<int>& ordered ) | 264 | void AbView::setListOrder( const QValueList<int>& ordered ) |
263 | { | 265 | { |
264 | m_orderedFields = ordered; | 266 | m_orderedFields = ordered; |
265 | if ( m_abTable ){ | 267 | if ( m_abTable ){ |
266 | m_abTable->setOrderedList( ordered ); | 268 | m_abTable->setOrderedList( ordered ); |
267 | m_abTable->refresh(); | 269 | m_abTable->refresh(); |
268 | } | 270 | } |
269 | updateView(); | 271 | updateView(); |
270 | } | 272 | } |
271 | 273 | ||
272 | 274 | ||
273 | QString AbView::showCategory() const | 275 | QString AbView::showCategory() const |
274 | { | 276 | { |
275 | return mCat.label( "Contacts", m_curr_category ); | 277 | return mCat.label( "Contacts", m_curr_category ); |
276 | } | 278 | } |
277 | 279 | ||
278 | void AbView::showPersonal( bool personal ) | 280 | void AbView::showPersonal( bool personal ) |
279 | { | 281 | { |
280 | qWarning ("void AbView::showPersonal( %d )", personal); | 282 | Opie::Core::owarn << "void AbView::showPersonal( " << personal << " )" << oendl; |
281 | 283 | ||
282 | if ( personal ){ | 284 | if ( personal ){ |
283 | 285 | ||
284 | if ( m_inPersonal ) | 286 | if ( m_inPersonal ) |
285 | return; | 287 | return; |
286 | 288 | ||
287 | // Now switch to vCard Backend and load data. | 289 | // Now switch to vCard Backend and load data. |
288 | // The current default backend will be stored | 290 | // The current default backend will be stored |
289 | // to avoid unneeded load/stores. | 291 | // to avoid unneeded load/stores. |
290 | m_storedDB = m_contactdb; | 292 | m_storedDB = m_contactdb; |
291 | 293 | ||
292 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 294 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
293 | addressbookPersonalVCardName() ); | 295 | addressbookPersonalVCardName() ); |
294 | m_contactdb = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 296 | m_contactdb = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
295 | 297 | ||
296 | m_inPersonal = true; | 298 | m_inPersonal = true; |
297 | m_curr_View = CardView; | 299 | m_curr_View = CardView; |
298 | 300 | ||
299 | }else{ | 301 | }else{ |
300 | 302 | ||
301 | if ( !m_inPersonal ) | 303 | if ( !m_inPersonal ) |
302 | return; | 304 | return; |
303 | 305 | ||
304 | // Remove vCard Backend and restore default | 306 | // Remove vCard Backend and restore default |
305 | m_contactdb->save(); | 307 | m_contactdb->save(); |
306 | delete m_contactdb; | 308 | delete m_contactdb; |
307 | 309 | ||
308 | m_contactdb = m_storedDB; | 310 | m_contactdb = m_storedDB; |
309 | m_storedDB = 0l; | 311 | m_storedDB = 0l; |
310 | 312 | ||
311 | m_curr_View = TableView; | 313 | m_curr_View = TableView; |
312 | m_inPersonal = false; | 314 | m_inPersonal = false; |
313 | 315 | ||
314 | } | 316 | } |
315 | load(); | 317 | load(); |
316 | } | 318 | } |
317 | 319 | ||
318 | void AbView::setCurrentUid( int uid ){ | 320 | void AbView::setCurrentUid( int uid ){ |
319 | 321 | ||
320 | m_curr_Contact = uid; | 322 | m_curr_Contact = uid; |
321 | updateView( true ); //true: Don't modificate the UID ! | 323 | updateView( true ); //true: Don't modificate the UID ! |
322 | } | 324 | } |
323 | 325 | ||
324 | 326 | ||
325 | QStringList AbView::categories() | 327 | QStringList AbView::categories() |
326 | { | 328 | { |
327 | mCat.load( categoryFileName() ); | 329 | mCat.load( categoryFileName() ); |
328 | QStringList categoryList = mCat.labels( "Contacts" ); | 330 | QStringList categoryList = mCat.labels( "Contacts" ); |
329 | return categoryList; | 331 | return categoryList; |
330 | } | 332 | } |
331 | 333 | ||
332 | // BEGIN: Slots | 334 | // BEGIN: Slots |
333 | void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | 335 | void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, |
334 | bool , QString cat ) | 336 | bool , QString cat ) |
335 | { | 337 | { |
336 | //qWarning( "void AbView::slotDoFind" ); | 338 | //Opie::Core::owarn << "void AbView::slotDoFind" << oendl; |
337 | 339 | ||
338 | // We reloading the data: Deselect Letterpicker | 340 | // We reloading the data: Deselect Letterpicker |
339 | emit signalClearLetterPicker(); | 341 | emit signalClearLetterPicker(); |
340 | 342 | ||
341 | // Use the current Category if nothing else selected | 343 | // Use the current Category if nothing else selected |
342 | int category = 0; | 344 | int category = 0; |
343 | 345 | ||
344 | if ( cat.isEmpty() ) | 346 | if ( cat.isEmpty() ) |
345 | category = m_curr_category; | 347 | category = m_curr_category; |
346 | else{ | 348 | else{ |
347 | category = mCat.id("Contacts", cat ); | 349 | category = mCat.id("Contacts", cat ); |
348 | } | 350 | } |
349 | 351 | ||
350 | //qWarning ("Find in Category %d", category); | 352 | //Opie::Core::owarn << "Find in Category " << category << oendl; |
351 | 353 | ||
352 | QRegExp r( str ); | 354 | QRegExp r( str ); |
353 | r.setCaseSensitive( caseSensitive ); | 355 | r.setCaseSensitive( caseSensitive ); |
354 | r.setWildcard( !useRegExp ); | 356 | r.setWildcard( !useRegExp ); |
355 | 357 | ||
356 | // Get all matching entries out of the database | 358 | // Get all matching entries out of the database |
357 | m_list = m_contactdb->matchRegexp( r ); | 359 | m_list = m_contactdb->matchRegexp( r ); |
358 | 360 | ||
359 | //qWarning( "found: %d", m_list.count() ); | 361 | //Opie::Core::owarn << "Found: " << m_list.count() << oendl; |
360 | if ( m_list.count() == 0 ){ | 362 | if ( m_list.count() == 0 ){ |
361 | emit signalNotFound(); | 363 | emit signalNotFound(); |
362 | return; | 364 | return; |
363 | } | 365 | } |
364 | 366 | ||
365 | // Now remove all contacts with wrong category (if any selected) | 367 | // Now remove all contacts with wrong category (if any selected) |
366 | // This algorithm is a litte bit ineffective, but | 368 | // This algorithm is a litte bit ineffective, but |
367 | // we will not have a lot of matching entries.. | 369 | // we will not have a lot of matching entries.. |
368 | if ( m_curr_category != -1 ) | 370 | if ( m_curr_category != -1 ) |
369 | clearForCategory(); | 371 | clearForCategory(); |
370 | 372 | ||
371 | // Now show all found entries | 373 | // Now show all found entries |
372 | updateView( true ); | 374 | updateView( true ); |
373 | } | 375 | } |
374 | 376 | ||
375 | void AbView::offSearch() | 377 | void AbView::offSearch() |
376 | { | 378 | { |
377 | m_inSearch = false; | 379 | m_inSearch = false; |
378 | 380 | ||
379 | load(); | 381 | load(); |
380 | } | 382 | } |
381 | 383 | ||
382 | void AbView::slotSwitch(){ | 384 | void AbView::slotSwitch(){ |
383 | //qWarning("AbView::slotSwitch()"); | 385 | //Opie::Core::owarn << "AbView::slotSwitch()" << oendl; |
384 | 386 | ||
385 | m_prev_View = m_curr_View; | 387 | m_prev_View = m_curr_View; |
386 | switch ( (int) m_curr_View ){ | 388 | switch ( (int) m_curr_View ){ |
387 | case TableView: | 389 | case TableView: |
388 | qWarning("Switching to CardView"); | 390 | Opie::Core::owarn << "Switching to CardView" << oendl; |
389 | m_curr_View = CardView; | 391 | m_curr_View = CardView; |
390 | break; | 392 | break; |
391 | case CardView: | 393 | case CardView: |
392 | qWarning("Switching to TableView"); | 394 | Opie::Core::owarn << "Switching to TableView" << oendl; |
393 | m_curr_View = TableView; | 395 | m_curr_View = TableView; |
394 | break; | 396 | break; |
395 | } | 397 | } |
396 | updateView(); | 398 | updateView(); |
397 | 399 | ||
398 | } | 400 | } |
399 | 401 | ||
400 | // END: Slots | 402 | // END: Slots |
401 | 403 | ||
402 | void AbView::clearForCategory() | 404 | void AbView::clearForCategory() |
403 | { | 405 | { |
404 | Opie::OPimContactAccess::List::Iterator it; | 406 | Opie::OPimContactAccess::List::Iterator it; |
405 | // Now remove all contacts with wrong category if any category selected | 407 | // Now remove all contacts with wrong category if any category selected |
406 | 408 | ||
407 | Opie::OPimContactAccess::List allList = m_list; | 409 | Opie::OPimContactAccess::List allList = m_list; |
408 | if ( m_curr_category != -1 ){ | 410 | if ( m_curr_category != -1 ){ |
409 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 411 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
410 | if ( !contactCompare( *it, m_curr_category ) ){ | 412 | if ( !contactCompare( *it, m_curr_category ) ){ |
411 | // qWarning("Removing %d", (*it).uid()); | 413 | //Opie::Core::owarn << "Removing " << (*it).uid() << oendl; |
412 | m_list.remove( (*it).uid() ); | 414 | m_list.remove( (*it).uid() ); |
413 | } | 415 | } |
414 | } | 416 | } |
415 | } | 417 | } |
416 | 418 | ||
417 | } | 419 | } |
418 | 420 | ||
419 | bool AbView::contactCompare( const Opie::OPimContact &cnt, int category ) | 421 | bool AbView::contactCompare( const Opie::OPimContact &cnt, int category ) |
420 | { | 422 | { |
421 | //qWarning ("bool AbView::contactCompare( const Opie::OPimContact &cnt, %d )", category); | 423 | //Opie::Core::owarn << "bool AbView::contactCompare( const Opie::OPimContact &cnt, " |
424 | // << category << " )" << oendl; | ||
422 | 425 | ||
423 | bool returnMe; | 426 | bool returnMe; |
424 | QArray<int> cats; | 427 | QArray<int> cats; |
425 | cats = cnt.categories(); | 428 | cats = cnt.categories(); |
426 | 429 | ||
427 | //qWarning ("Number of categories: %d", cats.count() ); | 430 | //Opie::Core::owarn << "Number of categories: " << cats.count() << oendl; |
428 | 431 | ||
429 | returnMe = false; | 432 | returnMe = false; |
430 | if ( cats.count() == 0 && category == 0 ) | 433 | if ( cats.count() == 0 && category == 0 ) |
431 | // Contacts with no category will just shown on "All" and "Unfiled" | 434 | // Contacts with no category will just shown on "All" and "Unfiled" |
432 | returnMe = true; | 435 | returnMe = true; |
433 | else { | 436 | else { |
434 | int i; | 437 | int i; |
435 | for ( i = 0; i < int(cats.count()); i++ ) { | 438 | for ( i = 0; i < int(cats.count()); i++ ) { |
436 | // qWarning("Comparing %d with %d",cats[i],category ); | 439 | //Opie::Core::owarn << "Comparing " << cats[i] << " with " << category << oendl; |
437 | if ( cats[i] == category ) { | 440 | if ( cats[i] == category ) { |
438 | returnMe = true; | 441 | returnMe = true; |
439 | break; | 442 | break; |
440 | } | 443 | } |
441 | } | 444 | } |
442 | } | 445 | } |
443 | //qWarning ("Return: %d", returnMe); | 446 | //Opie::Core::owarn << "Return: " << returnMe << oendl; |
444 | return returnMe; | 447 | return returnMe; |
445 | } | 448 | } |
446 | 449 | ||
447 | // In Some rare cases we have to update all lists.. | 450 | // In Some rare cases we have to update all lists.. |
448 | void AbView::updateListinViews() | 451 | void AbView::updateListinViews() |
449 | { | 452 | { |
450 | m_abTable -> setContacts( m_list ); | 453 | m_abTable -> setContacts( m_list ); |
451 | m_ablabel -> setContacts( m_list ); | 454 | m_ablabel -> setContacts( m_list ); |
452 | } | 455 | } |
453 | 456 | ||
454 | void AbView::updateView( bool newdata ) | 457 | void AbView::updateView( bool newdata ) |
455 | { | 458 | { |
456 | //qWarning("AbView::updateView()"); | 459 | //Opie::Core::owarn << "AbView::updateView()" << oendl; |
457 | 460 | ||
458 | if ( m_viewStack -> visibleWidget() ){ | 461 | if ( m_viewStack -> visibleWidget() ){ |
459 | m_viewStack -> visibleWidget() -> clearFocus(); | 462 | m_viewStack -> visibleWidget() -> clearFocus(); |
460 | } | 463 | } |
461 | 464 | ||
462 | // If we switching the view, we have to store some information | 465 | // If we switching the view, we have to store some information |
463 | if ( !newdata ){ | 466 | if ( !newdata ){ |
464 | if ( m_list.count() ){ | 467 | if ( m_list.count() ){ |
465 | switch ( (int) m_prev_View ) { | 468 | switch ( (int) m_prev_View ) { |
466 | case TableView: | 469 | case TableView: |
467 | m_curr_Contact = m_abTable -> currentEntry_UID(); | 470 | m_curr_Contact = m_abTable -> currentEntry_UID(); |
468 | break; | 471 | break; |
469 | case CardView: | 472 | case CardView: |
470 | m_curr_Contact = m_ablabel -> currentEntry_UID(); | 473 | m_curr_Contact = m_ablabel -> currentEntry_UID(); |
471 | break; | 474 | break; |
472 | } | 475 | } |
473 | }else | 476 | }else |
474 | m_curr_Contact = 0; | 477 | m_curr_Contact = 0; |
475 | } | 478 | } |
476 | 479 | ||
477 | // Feed all views with new lists | 480 | // Feed all views with new lists |
478 | if ( newdata ) | 481 | if ( newdata ) |
479 | updateListinViews(); | 482 | updateListinViews(); |
480 | 483 | ||
481 | // Tell the world that the view is changed | 484 | // Tell the world that the view is changed |
482 | if ( m_curr_View != m_prev_View ) | 485 | if ( m_curr_View != m_prev_View ) |
483 | emit signalViewSwitched ( (int) m_curr_View ); | 486 | emit signalViewSwitched ( (int) m_curr_View ); |
484 | 487 | ||
485 | m_prev_View = m_curr_View; | 488 | m_prev_View = m_curr_View; |
486 | 489 | ||
487 | // Switch to new View | 490 | // Switch to new View |
488 | switch ( (int) m_curr_View ) { | 491 | switch ( (int) m_curr_View ) { |
489 | case TableView: | 492 | case TableView: |
490 | m_abTable -> setChoiceSelection( m_orderedFields ); | 493 | m_abTable -> setChoiceSelection( m_orderedFields ); |
491 | if ( m_curr_Contact != 0 ) | 494 | if ( m_curr_Contact != 0 ) |
492 | m_abTable -> selectContact ( m_curr_Contact ); | 495 | m_abTable -> selectContact ( m_curr_Contact ); |
493 | m_abTable -> setFocus(); | 496 | m_abTable -> setFocus(); |
494 | break; | 497 | break; |
495 | case CardView: | 498 | case CardView: |
496 | if ( m_curr_Contact != 0 ) | 499 | if ( m_curr_Contact != 0 ) |
497 | m_ablabel -> selectContact( m_curr_Contact ); | 500 | m_ablabel -> selectContact( m_curr_Contact ); |
498 | m_ablabel -> setFocus(); | 501 | m_ablabel -> setFocus(); |
499 | break; | 502 | break; |
500 | } | 503 | } |
501 | 504 | ||
502 | // Raise the current View | 505 | // Raise the current View |
503 | m_viewStack -> raiseWidget( m_curr_View ); | 506 | m_viewStack -> raiseWidget( m_curr_View ); |
504 | } | 507 | } |
505 | 508 | ||
506 | 509 | ||
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 9ae66d1..94c0a13 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -1,1041 +1,1042 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** Copyright (C) 2003 Stefan Eilers (eilers.stefan@epost.de) | 3 | ** Copyright (C) 2003 Stefan Eilers (eilers.stefan@epost.de) |
4 | ** | 4 | ** |
5 | ** This file is part of the Open Palmtop Environment (see www.opie.info). | 5 | ** This file is part of the Open Palmtop Environment (see www.opie.info). |
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 | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging 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 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** | 17 | ** |
18 | **********************************************************************/ | 18 | **********************************************************************/ |
19 | 19 | ||
20 | #define QTOPIA_INTERNAL_FD | 20 | #define QTOPIA_INTERNAL_FD |
21 | 21 | ||
22 | // #include "addresssettings.h" | 22 | // #include "addresssettings.h" |
23 | #include "addressbook.h" | 23 | #include "addressbook.h" |
24 | 24 | ||
25 | 25 | #include <opie2/odebug.h> | |
26 | #include <opie2/ofileselector.h> | 26 | #include <opie2/ofileselector.h> |
27 | #include <opie2/ofiledialog.h> | 27 | #include <opie2/ofiledialog.h> |
28 | #include <opie2/opimcontact.h> | 28 | #include <opie2/opimcontact.h> |
29 | #include <opie2/ocontactaccessbackend_vcard.h> | 29 | #include <opie2/ocontactaccessbackend_vcard.h> |
30 | 30 | ||
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | #include <qpe/ir.h> | 32 | #include <qpe/ir.h> |
33 | #include <qpe/qpemessagebox.h> | 33 | #include <qpe/qpemessagebox.h> |
34 | #include <qmenubar.h> | 34 | #include <qmenubar.h> |
35 | // #include <qtoolbar.h> | 35 | // #include <qtoolbar.h> |
36 | // #include <qmenubar.h> | 36 | // #include <qmenubar.h> |
37 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
38 | 38 | ||
39 | #include <qaction.h> | 39 | #include <qaction.h> |
40 | #include <qlayout.h> | 40 | #include <qlayout.h> |
41 | #include <qmessagebox.h> | 41 | #include <qmessagebox.h> |
42 | #include <qtoolbutton.h> | 42 | #include <qtoolbutton.h> |
43 | 43 | ||
44 | #include <stdlib.h> | 44 | #include <stdlib.h> |
45 | #include <sys/stat.h> | 45 | #include <sys/stat.h> |
46 | #include <sys/types.h> | 46 | #include <sys/types.h> |
47 | #include <fcntl.h> | 47 | #include <fcntl.h> |
48 | #include <unistd.h> | 48 | #include <unistd.h> |
49 | 49 | ||
50 | 50 | ||
51 | #include "picker.h" | 51 | #include "picker.h" |
52 | #include "configdlg.h" | 52 | #include "configdlg.h" |
53 | 53 | ||
54 | extern QString addressbookPersonalVCardName(); | 54 | extern QString addressbookPersonalVCardName(); |
55 | 55 | ||
56 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | 56 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, |
57 | WFlags f ) | 57 | WFlags f ) |
58 | : QMainWindow( parent, name, f ), | 58 | : QMainWindow( parent, name, f ), |
59 | catMenu (0l), | 59 | catMenu (0l), |
60 | abEditor(0l), | 60 | abEditor(0l), |
61 | syncing(FALSE), | 61 | syncing(FALSE), |
62 | m_tableViewButton(0l), | 62 | m_tableViewButton(0l), |
63 | m_cardViewButton(0l) | 63 | m_cardViewButton(0l) |
64 | { | 64 | { |
65 | isLoading = true; | 65 | isLoading = true; |
66 | 66 | ||
67 | m_config.load(); | 67 | m_config.load(); |
68 | 68 | ||
69 | setCaption( tr("Contacts") ); | 69 | setCaption( tr("Contacts") ); |
70 | setIcon( Resource::loadPixmap( "AddressBook" ) ); | 70 | setIcon( Resource::loadPixmap( "AddressBook" ) ); |
71 | 71 | ||
72 | // Settings for Main Menu | 72 | // Settings for Main Menu |
73 | // setToolBarsMovable( false ); | 73 | // setToolBarsMovable( false ); |
74 | setToolBarsMovable( !m_config.fixedBars() ); | 74 | setToolBarsMovable( !m_config.fixedBars() ); |
75 | setRightJustification( true ); | 75 | setRightJustification( true ); |
76 | 76 | ||
77 | QToolBar *bar = new QToolBar( this ); | 77 | QToolBar *bar = new QToolBar( this ); |
78 | bar->setHorizontalStretchable( TRUE ); | 78 | bar->setHorizontalStretchable( TRUE ); |
79 | 79 | ||
80 | QMenuBar *mbList = new QMenuBar( bar ); | 80 | QMenuBar *mbList = new QMenuBar( bar ); |
81 | mbList->setMargin( 0 ); | 81 | mbList->setMargin( 0 ); |
82 | 82 | ||
83 | QPopupMenu *edit = new QPopupMenu( mbList ); | 83 | QPopupMenu *edit = new QPopupMenu( mbList ); |
84 | mbList->insertItem( tr( "Contact" ), edit ); | 84 | mbList->insertItem( tr( "Contact" ), edit ); |
85 | 85 | ||
86 | // Category Menu | 86 | // Category Menu |
87 | catMenu = new QPopupMenu( this ); | 87 | catMenu = new QPopupMenu( this ); |
88 | catMenu->setCheckable( TRUE ); | 88 | catMenu->setCheckable( TRUE ); |
89 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 89 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
90 | mbList->insertItem( tr("View"), catMenu ); | 90 | mbList->insertItem( tr("View"), catMenu ); |
91 | 91 | ||
92 | // Create Toolbar | 92 | // Create Toolbar |
93 | listTools = new QToolBar( this, "list operations" ); | 93 | listTools = new QToolBar( this, "list operations" ); |
94 | listTools->setHorizontalStretchable( true ); | 94 | listTools->setHorizontalStretchable( true ); |
95 | addToolBar( listTools ); | 95 | addToolBar( listTools ); |
96 | moveToolBar( listTools, m_config.getToolBarPos() ); | 96 | moveToolBar( listTools, m_config.getToolBarPos() ); |
97 | 97 | ||
98 | // View Icons | 98 | // View Icons |
99 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/listview" ), | 99 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/listview" ), |
100 | QString::null, 0, this, 0 ); | 100 | QString::null, 0, this, 0 ); |
101 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); | 101 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); |
102 | m_tableViewButton->setToggleAction( true ); | 102 | m_tableViewButton->setToggleAction( true ); |
103 | m_tableViewButton->addTo( listTools ); | 103 | m_tableViewButton->addTo( listTools ); |
104 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "addressbook/cardview" ), QString::null, 0, this, 0 ); | 104 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "addressbook/cardview" ), QString::null, 0, this, 0 ); |
105 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); | 105 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); |
106 | m_cardViewButton->setToggleAction( true ); | 106 | m_cardViewButton->setToggleAction( true ); |
107 | m_cardViewButton->addTo( listTools ); | 107 | m_cardViewButton->addTo( listTools ); |
108 | 108 | ||
109 | listTools->addSeparator(); | 109 | listTools->addSeparator(); |
110 | 110 | ||
111 | // Other Buttons | 111 | // Other Buttons |
112 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, | 112 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, |
113 | 0, this, 0 ); | 113 | 0, this, 0 ); |
114 | actionNew = a; | 114 | actionNew = a; |
115 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); | 115 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); |
116 | a->addTo( edit ); | 116 | a->addTo( edit ); |
117 | a->addTo( listTools ); | 117 | a->addTo( listTools ); |
118 | 118 | ||
119 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | 119 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, |
120 | 0, this, 0 ); | 120 | 0, this, 0 ); |
121 | actionEdit = a; | 121 | actionEdit = a; |
122 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); | 122 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); |
123 | a->addTo( edit ); | 123 | a->addTo( edit ); |
124 | a->addTo( listTools ); | 124 | a->addTo( listTools ); |
125 | 125 | ||
126 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 126 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
127 | 0, this, 0 ); | 127 | 0, this, 0 ); |
128 | actionTrash = a; | 128 | actionTrash = a; |
129 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); | 129 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); |
130 | a->addTo( edit ); | 130 | a->addTo( edit ); |
131 | a->addTo( listTools ); | 131 | a->addTo( listTools ); |
132 | 132 | ||
133 | 133 | ||
134 | // make it possible to go directly to businesscard via qcop call | 134 | // make it possible to go directly to businesscard via qcop call |
135 | //#if defined(Q_WS_QWS) // Why this ? (se) | 135 | //#if defined(Q_WS_QWS) // Why this ? (se) |
136 | #if !defined(QT_NO_COP) | 136 | #if !defined(QT_NO_COP) |
137 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); | 137 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); |
138 | connect (addressChannel, SIGNAL( received(const QCString&,const QByteArray&)), | 138 | connect (addressChannel, SIGNAL( received(const QCString&,const QByteArray&)), |
139 | this, SLOT ( appMessage(const QCString&,const QByteArray&) ) ); | 139 | this, SLOT ( appMessage(const QCString&,const QByteArray&) ) ); |
140 | #endif | 140 | #endif |
141 | // #endif | 141 | // #endif |
142 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), | 142 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), |
143 | QString::null, 0, this, 0 ); | 143 | QString::null, 0, this, 0 ); |
144 | actionFind = a; | 144 | actionFind = a; |
145 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); | 145 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); |
146 | a->addTo( edit ); | 146 | a->addTo( edit ); |
147 | a->addTo( listTools ); | 147 | a->addTo( listTools ); |
148 | 148 | ||
149 | // Much better search widget, taken from QTReader.. (se) | 149 | // Much better search widget, taken from QTReader.. (se) |
150 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); | 150 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); |
151 | searchBar->setHorizontalStretchable( TRUE ); | 151 | searchBar->setHorizontalStretchable( TRUE ); |
152 | searchBar->hide(); | 152 | searchBar->hide(); |
153 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 153 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
154 | 154 | ||
155 | // QFont f("unifont", 16 /*, QFont::Bold*/); | 155 | // QFont f("unifont", 16 /*, QFont::Bold*/); |
156 | // searchEdit->setFont( f ); | 156 | // searchEdit->setFont( f ); |
157 | 157 | ||
158 | searchBar->setStretchableWidget( searchEdit ); | 158 | searchBar->setStretchableWidget( searchEdit ); |
159 | connect( searchEdit, SIGNAL( returnPressed() ), | 159 | connect( searchEdit, SIGNAL( returnPressed() ), |
160 | this, SLOT( slotFind() ) ); | 160 | this, SLOT( slotFind() ) ); |
161 | 161 | ||
162 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | 162 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); |
163 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | 163 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); |
164 | a->addTo( searchBar ); | 164 | a->addTo( searchBar ); |
165 | 165 | ||
166 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 166 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
167 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); | 167 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); |
168 | a->addTo( searchBar ); | 168 | a->addTo( searchBar ); |
169 | 169 | ||
170 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), | 170 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), |
171 | QString::null, 0, this, 0 ); | 171 | QString::null, 0, this, 0 ); |
172 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 172 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
173 | actionMail = a; | 173 | actionMail = a; |
174 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 174 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
175 | a->addTo( edit ); | 175 | a->addTo( edit ); |
176 | a->addTo( listTools ); | 176 | a->addTo( listTools ); |
177 | 177 | ||
178 | if ( Ir::supported() ) { | 178 | if ( Ir::supported() ) { |
179 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | 179 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, |
180 | 0, this, 0 ); | 180 | 0, this, 0 ); |
181 | actionBeam = a; | 181 | actionBeam = a; |
182 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 182 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
183 | a->addTo( edit ); | 183 | a->addTo( edit ); |
184 | a->addTo( listTools ); | 184 | a->addTo( listTools ); |
185 | } | 185 | } |
186 | 186 | ||
187 | edit->insertSeparator(); | 187 | edit->insertSeparator(); |
188 | 188 | ||
189 | a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null, | 189 | a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null, |
190 | 0, this, 0); | 190 | 0, this, 0); |
191 | actionPersonal = a; | 191 | actionPersonal = a; |
192 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); | 192 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); |
193 | a->addTo( edit ); | 193 | a->addTo( edit ); |
194 | 194 | ||
195 | a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), QString::null, | 195 | a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), QString::null, |
196 | 0, this, 0); | 196 | 0, this, 0); |
197 | actionPersonal = a; | 197 | actionPersonal = a; |
198 | connect( a, SIGNAL( activated() ), this, SLOT( exportvCard() ) ); | 198 | connect( a, SIGNAL( activated() ), this, SLOT( exportvCard() ) ); |
199 | a->addTo( edit ); | 199 | a->addTo( edit ); |
200 | 200 | ||
201 | edit->insertSeparator(); | 201 | edit->insertSeparator(); |
202 | 202 | ||
203 | a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), | 203 | a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), |
204 | QString::null, 0, this, 0 , TRUE ); | 204 | QString::null, 0, this, 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( "SettingsIcon" ), QString::null, | 217 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "SettingsIcon" ), 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(); // Already done by c'tor . | 235 | // m_abView->load(); // Already done by c'tor . |
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 | // All Categories into view-menu.. | 244 | // All Categories into view-menu.. |
245 | populateCategories(); | 245 | populateCategories(); |
246 | 246 | ||
247 | // Fontsize | 247 | // Fontsize |
248 | defaultFont = new QFont( m_abView->font() ); | 248 | defaultFont = new QFont( m_abView->font() ); |
249 | slotSetFont(m_config.fontSize()); | 249 | slotSetFont(m_config.fontSize()); |
250 | m_curFontSize = m_config.fontSize(); | 250 | m_curFontSize = m_config.fontSize(); |
251 | 251 | ||
252 | setCentralWidget(listContainer); | 252 | setCentralWidget(listContainer); |
253 | 253 | ||
254 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 254 | //Opie::Core::odebug << "adressbook contrsuction: t=" << t.elapsed() << oendl; |
255 | connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); | 255 | connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); |
256 | connect( qApp, SIGNAL( reload() ), this, SLOT( reload() ) ); | 256 | connect( qApp, SIGNAL( reload() ), this, SLOT( reload() ) ); |
257 | connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), | 257 | connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), |
258 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); | 258 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); |
259 | 259 | ||
260 | 260 | ||
261 | isLoading = false; | 261 | isLoading = false; |
262 | } | 262 | } |
263 | 263 | ||
264 | 264 | ||
265 | void AddressbookWindow::slotConfig() | 265 | void AddressbookWindow::slotConfig() |
266 | { | 266 | { |
267 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); | 267 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); |
268 | dlg -> setConfig( m_config ); | 268 | dlg -> setConfig( m_config ); |
269 | if ( QPEApplication::execDialog( dlg ) ) { | 269 | if ( QPEApplication::execDialog( dlg ) ) { |
270 | qWarning ("Config Dialog accepted!"); | 270 | Opie::Core::owarn << "Config Dialog accepted!" << oendl; |
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 | Opie::Core::owarn << "Font was changed!" << oendl; |
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 | Opie::Core::owarn << "void AddressbookWindow::slotSetFont( " << size << " )" << oendl; |
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 = Opie::Ui::OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); | 320 | QString str = Opie::Ui::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 | void AddressbookWindow::exportvCard() | 326 | void AddressbookWindow::exportvCard() |
327 | { | 327 | { |
328 | qWarning(" void AddressbookWindow::exportvCard()"); | 328 | Opie::Core::owarn << "void AddressbookWindow::exportvCard()" << oendl; |
329 | QString filename = Opie::Ui::OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this ); | 329 | QString filename = Opie::Ui::OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this ); |
330 | if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){ | 330 | if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){ |
331 | qWarning(" Save to file %s, (%d)", filename.latin1(), filename.length()-1 ); | 331 | Opie::Core::owarn << " Save to file " << filename << ", (" << filename.length()-1 << ")" << oendl; |
332 | Opie::OPimContact curCont = m_abView->currentEntry(); | 332 | Opie::OPimContact curCont = m_abView->currentEntry(); |
333 | if ( !curCont.isEmpty() ){ | 333 | if ( !curCont.isEmpty() ){ |
334 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 334 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
335 | filename ); | 335 | filename ); |
336 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook_exp", QString::null , vcard_backend, true ); | 336 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook_exp", QString::null , vcard_backend, true ); |
337 | if ( access ){ | 337 | if ( access ){ |
338 | access->add( curCont ); | 338 | access->add( curCont ); |
339 | access->save(); | 339 | access->save(); |
340 | } | 340 | } |
341 | delete access; | 341 | delete access; |
342 | }else | 342 | }else |
343 | QMessageBox::critical( 0, "Export VCard", | 343 | QMessageBox::critical( 0, "Export VCard", |
344 | QString( tr( "You have to select a contact !") ) ); | 344 | QString( tr( "You have to select a contact !") ) ); |
345 | 345 | ||
346 | }else | 346 | }else |
347 | QMessageBox::critical( 0, "Export VCard", | 347 | QMessageBox::critical( 0, "Export VCard", |
348 | QString( tr( "You have to set a filename !") ) ); | 348 | QString( tr( "You have to set a filename !") ) ); |
349 | } | 349 | } |
350 | 350 | ||
351 | void AddressbookWindow::setDocument( const QString &filename ) | 351 | void AddressbookWindow::setDocument( const QString &filename ) |
352 | { | 352 | { |
353 | qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); | 353 | Opie::Core::owarn << "void AddressbookWindow::setDocument( " << filename << " )" << oendl; |
354 | 354 | ||
355 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ | 355 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ |
356 | 356 | ||
357 | 357 | ||
358 | 358 | ||
359 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), | 359 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), |
360 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), | 360 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), |
361 | tr( "&Yes" ), tr( "&No" ), QString::null, | 361 | tr( "&Yes" ), tr( "&No" ), QString::null, |
362 | 0, // Enter == button 0 | 362 | 0, // Enter == button 0 |
363 | 2 ) ) { // Escape == button 2 | 363 | 2 ) ) { // Escape == button 2 |
364 | case 0: | 364 | case 0: |
365 | qWarning("YES clicked"); | 365 | Opie::Core::owarn << "YES clicked" << oendl; |
366 | break; | 366 | break; |
367 | case 1: | 367 | case 1: |
368 | qWarning("NO clicked"); | 368 | Opie::Core::owarn << "NO clicked" << oendl; |
369 | return; | 369 | return; |
370 | break; | 370 | break; |
371 | } | 371 | } |
372 | } | 372 | } |
373 | 373 | ||
374 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 374 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
375 | filename ); | 375 | filename ); |
376 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 376 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
377 | Opie::OPimContactAccess::List allList = access->allRecords(); | 377 | Opie::OPimContactAccess::List allList = access->allRecords(); |
378 | qWarning( "Found number of contacts in File: %d", allList.count() ); | 378 | Opie::Core::owarn << "Found number of contacts in File: " << allList.count() << oendl; |
379 | 379 | ||
380 | if ( !allList.count() ) { | 380 | if ( !allList.count() ) { |
381 | QMessageBox::information( this, "Import VCard", | 381 | QMessageBox::information( this, "Import VCard", |
382 | "It was impossible to import\nthe VCard.\n" | 382 | "It was impossible to import\nthe VCard.\n" |
383 | "The VCard may be corrupted!" ); | 383 | "The VCard may be corrupted!" ); |
384 | } | 384 | } |
385 | 385 | ||
386 | bool doAsk = true; | 386 | bool doAsk = true; |
387 | Opie::OPimContactAccess::List::Iterator it; | 387 | Opie::OPimContactAccess::List::Iterator it; |
388 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 388 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
389 | qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); | 389 | Opie::Core::owarn << "Adding Contact from: " << (*it).fullName() << oendl; |
390 | if ( doAsk ){ | 390 | if ( doAsk ){ |
391 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), | 391 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), |
392 | tr( "Do you really want add contact for \n%1?" ) | 392 | tr( "Do you really want add contact for \n%1?" ) |
393 | .arg( (*it).fullName().latin1() ), | 393 | .arg( (*it).fullName().latin1() ), |
394 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), | 394 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), |
395 | 0, // Enter == button 0 | 395 | 0, // Enter == button 0 |
396 | 2 ) ) { // Escape == button 2 | 396 | 2 ) ) { // Escape == button 2 |
397 | case 0: | 397 | case 0: |
398 | qWarning("YES clicked"); | 398 | Opie::Core::owarn << "YES clicked" << oendl; |
399 | m_abView->addEntry( *it ); | 399 | m_abView->addEntry( *it ); |
400 | break; | 400 | break; |
401 | case 1: | 401 | case 1: |
402 | qWarning("NO clicked"); | 402 | Opie::Core::owarn << "NO clicked" << oendl; |
403 | break; | 403 | break; |
404 | case 2: | 404 | case 2: |
405 | qWarning("YesAll clicked"); | 405 | Opie::Core::owarn << "YesAll clicked" << oendl; |
406 | doAsk = false; | 406 | doAsk = false; |
407 | break; | 407 | break; |
408 | } | 408 | } |
409 | }else | 409 | }else |
410 | m_abView->addEntry( *it ); | 410 | m_abView->addEntry( *it ); |
411 | 411 | ||
412 | } | 412 | } |
413 | 413 | ||
414 | delete access; | 414 | delete access; |
415 | } | 415 | } |
416 | 416 | ||
417 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 417 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
418 | { | 418 | { |
419 | QMainWindow::resizeEvent( e ); | 419 | QMainWindow::resizeEvent( e ); |
420 | 420 | ||
421 | 421 | ||
422 | } | 422 | } |
423 | 423 | ||
424 | AddressbookWindow::~AddressbookWindow() | 424 | AddressbookWindow::~AddressbookWindow() |
425 | { | 425 | { |
426 | ToolBarDock dock; | 426 | ToolBarDock dock; |
427 | int dummy; | 427 | int dummy; |
428 | bool bDummy; | 428 | bool bDummy; |
429 | getLocation ( listTools, dock, dummy, bDummy, dummy ); | 429 | getLocation ( listTools, dock, dummy, bDummy, dummy ); |
430 | m_config.setToolBarDock( dock ); | 430 | m_config.setToolBarDock( dock ); |
431 | m_config.save(); | 431 | m_config.save(); |
432 | } | 432 | } |
433 | 433 | ||
434 | void AddressbookWindow::slotUpdateToolbar() | 434 | void AddressbookWindow::slotUpdateToolbar() |
435 | { | 435 | { |
436 | Opie::OPimContact ce = m_abView->currentEntry(); | 436 | Opie::OPimContact ce = m_abView->currentEntry(); |
437 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 437 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
438 | } | 438 | } |
439 | 439 | ||
440 | void AddressbookWindow::slotListNew() | 440 | void AddressbookWindow::slotListNew() |
441 | { | 441 | { |
442 | Opie::OPimContact cnt; | 442 | Opie::OPimContact cnt; |
443 | if( !syncing ) { | 443 | if( !syncing ) { |
444 | editEntry( NewEntry ); | 444 | editEntry( NewEntry ); |
445 | } else { | 445 | } else { |
446 | QMessageBox::warning(this, tr("Contacts"), | 446 | QMessageBox::warning(this, tr("Contacts"), |
447 | tr("Can not edit data, currently syncing")); | 447 | tr("Can not edit data, currently syncing")); |
448 | } | 448 | } |
449 | } | 449 | } |
450 | 450 | ||
451 | // void AddressbookWindow::slotListView() | 451 | // void AddressbookWindow::slotListView() |
452 | // { | 452 | // { |
453 | // m_abView -> init( abList->currentEntry() ); | 453 | // m_abView -> init( abList->currentEntry() ); |
454 | // // :SX mView->sync(); | 454 | // // :SX mView->sync(); |
455 | // //:SXshowView(); | 455 | // //:SXshowView(); |
456 | // } | 456 | // } |
457 | 457 | ||
458 | void AddressbookWindow::slotListDelete() | 458 | void AddressbookWindow::slotListDelete() |
459 | { | 459 | { |
460 | if(!syncing) { | 460 | if(!syncing) { |
461 | Opie::OPimContact tmpEntry = m_abView ->currentEntry(); | 461 | Opie::OPimContact tmpEntry = m_abView ->currentEntry(); |
462 | 462 | ||
463 | // get a name, do the best we can... | 463 | // get a name, do the best we can... |
464 | QString strName = tmpEntry.fullName(); | 464 | QString strName = tmpEntry.fullName(); |
465 | if ( strName.isEmpty() ) { | 465 | if ( strName.isEmpty() ) { |
466 | strName = tmpEntry.company(); | 466 | strName = tmpEntry.company(); |
467 | if ( strName.isEmpty() ) | 467 | if ( strName.isEmpty() ) |
468 | strName = "No Name"; | 468 | strName = "No Name"; |
469 | } | 469 | } |
470 | 470 | ||
471 | 471 | ||
472 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), | 472 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), |
473 | strName ) ) { | 473 | strName ) ) { |
474 | m_abView->removeEntry( tmpEntry.uid() ); | 474 | m_abView->removeEntry( tmpEntry.uid() ); |
475 | } | 475 | } |
476 | } else { | 476 | } else { |
477 | QMessageBox::warning( this, tr("Contacts"), | 477 | QMessageBox::warning( this, tr("Contacts"), |
478 | tr("Can not edit data, currently syncing") ); | 478 | tr("Can not edit data, currently syncing") ); |
479 | } | 479 | } |
480 | } | 480 | } |
481 | 481 | ||
482 | void AddressbookWindow::slotFindOpen() | 482 | void AddressbookWindow::slotFindOpen() |
483 | { | 483 | { |
484 | searchBar->show(); | 484 | searchBar->show(); |
485 | m_abView -> inSearch(); | 485 | m_abView -> inSearch(); |
486 | searchEdit->setFocus(); | 486 | searchEdit->setFocus(); |
487 | } | 487 | } |
488 | void AddressbookWindow::slotFindClose() | 488 | void AddressbookWindow::slotFindClose() |
489 | { | 489 | { |
490 | searchBar->hide(); | 490 | searchBar->hide(); |
491 | m_abView -> offSearch(); | 491 | m_abView -> offSearch(); |
492 | // m_abView->setFocus(); | 492 | // m_abView->setFocus(); |
493 | } | 493 | } |
494 | 494 | ||
495 | 495 | ||
496 | void AddressbookWindow::slotFind() | 496 | void AddressbookWindow::slotFind() |
497 | { | 497 | { |
498 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); | 498 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); |
499 | 499 | ||
500 | searchEdit->clearFocus(); | 500 | searchEdit->clearFocus(); |
501 | // m_abView->setFocus(); | 501 | // m_abView->setFocus(); |
502 | 502 | ||
503 | } | 503 | } |
504 | 504 | ||
505 | void AddressbookWindow::slotViewBack() | 505 | void AddressbookWindow::slotViewBack() |
506 | { | 506 | { |
507 | // :SX showList(); | 507 | // :SX showList(); |
508 | } | 508 | } |
509 | 509 | ||
510 | void AddressbookWindow::slotViewEdit() | 510 | void AddressbookWindow::slotViewEdit() |
511 | { | 511 | { |
512 | if(!syncing) { | 512 | if(!syncing) { |
513 | if (actionPersonal->isOn()) { | 513 | if (actionPersonal->isOn()) { |
514 | editPersonal(); | 514 | editPersonal(); |
515 | } else { | 515 | } else { |
516 | editEntry( EditEntry ); | 516 | editEntry( EditEntry ); |
517 | } | 517 | } |
518 | } else { | 518 | } else { |
519 | QMessageBox::warning( this, tr("Contacts"), | 519 | QMessageBox::warning( this, tr("Contacts"), |
520 | tr("Can not edit data, currently syncing") ); | 520 | tr("Can not edit data, currently syncing") ); |
521 | } | 521 | } |
522 | } | 522 | } |
523 | 523 | ||
524 | 524 | ||
525 | 525 | ||
526 | void AddressbookWindow::writeMail() | 526 | void AddressbookWindow::writeMail() |
527 | { | 527 | { |
528 | Opie::OPimContact c = m_abView -> currentEntry(); | 528 | Opie::OPimContact c = m_abView -> currentEntry(); |
529 | QString name = c.fileAs(); | 529 | QString name = c.fileAs(); |
530 | QString email = c.defaultEmail(); | 530 | QString email = c.defaultEmail(); |
531 | 531 | ||
532 | // I prefer the OPIE-Environment variable before the | 532 | // I prefer the OPIE-Environment variable before the |
533 | // QPE-one.. | 533 | // QPE-one.. |
534 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); | 534 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); |
535 | if ( basepath.isEmpty() ) | 535 | if ( basepath.isEmpty() ) |
536 | basepath = QString::fromLatin1( getenv("QPEDIR") ); | 536 | basepath = QString::fromLatin1( getenv("QPEDIR") ); |
537 | 537 | ||
538 | // Try to access the preferred. If not possible, try to | 538 | // Try to access the preferred. If not possible, try to |
539 | // switch to the other one.. | 539 | // switch to the other one.. |
540 | if ( m_config.useQtMail() ){ | 540 | if ( m_config.useQtMail() ){ |
541 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); | 541 | Opie::Core::owarn << "Accessing: " << (basepath + "/bin/qtmail") << oendl; |
542 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ | 542 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ |
543 | qWarning ("QCop"); | 543 | Opie::Core::owarn << "QCop" << oendl; |
544 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 544 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); |
545 | e << name << email; | 545 | e << name << email; |
546 | return; | 546 | return; |
547 | } else | 547 | } else |
548 | m_config.setUseOpieMail( true ); | 548 | m_config.setUseOpieMail( true ); |
549 | } | 549 | } |
550 | if ( m_config.useOpieMail() ){ | 550 | if ( m_config.useOpieMail() ){ |
551 | qWarning ("Accessing: %s", (basepath + "/bin/opiemail").latin1()); | 551 | Opie::Core::owarn << "Accessing: " << (basepath + "/bin/opiemail") << oendl; |
552 | if ( QFile::exists( basepath + "/bin/opiemail" ) ){ | 552 | if ( QFile::exists( basepath + "/bin/opiemail" ) ){ |
553 | qWarning ("QCop"); | 553 | Opie::Core::owarn << "QCop" << oendl; |
554 | QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)"); | 554 | QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)"); |
555 | e << name << email; | 555 | e << name << email; |
556 | return; | 556 | return; |
557 | } else | 557 | } else |
558 | m_config.setUseQtMail( true ); | 558 | m_config.setUseQtMail( true ); |
559 | } | 559 | } |
560 | 560 | ||
561 | } | 561 | } |
562 | 562 | ||
563 | static const char * beamfile = "/tmp/obex/contact.vcf"; | 563 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
564 | 564 | ||
565 | void AddressbookWindow::slotBeam() | 565 | void AddressbookWindow::slotBeam() |
566 | { | 566 | { |
567 | QString beamFilename; | 567 | QString beamFilename; |
568 | Opie::OPimContact c; | 568 | Opie::OPimContact c; |
569 | if ( actionPersonal->isOn() ) { | 569 | if ( actionPersonal->isOn() ) { |
570 | beamFilename = addressbookPersonalVCardName(); | 570 | beamFilename = addressbookPersonalVCardName(); |
571 | if ( !QFile::exists( beamFilename ) ) | 571 | if ( !QFile::exists( beamFilename ) ) |
572 | return; // can't beam a non-existent file | 572 | return; // can't beam a non-existent file |
573 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 573 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
574 | beamFilename ); | 574 | beamFilename ); |
575 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 575 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
576 | Opie::OPimContactAccess::List allList = access->allRecords(); | 576 | Opie::OPimContactAccess::List allList = access->allRecords(); |
577 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | 577 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first |
578 | c = *it; | 578 | c = *it; |
579 | 579 | ||
580 | delete access; | 580 | delete access; |
581 | } else { | 581 | } else { |
582 | unlink( beamfile ); // delete if exists | 582 | unlink( beamfile ); // delete if exists |
583 | mkdir("/tmp/obex/", 0755); | 583 | mkdir("/tmp/obex/", 0755); |
584 | c = m_abView -> currentEntry(); | 584 | c = m_abView -> currentEntry(); |
585 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 585 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
586 | beamfile ); | 586 | beamfile ); |
587 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 587 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
588 | access->add( c ); | 588 | access->add( c ); |
589 | access->save(); | 589 | access->save(); |
590 | delete access; | 590 | delete access; |
591 | 591 | ||
592 | beamFilename = beamfile; | 592 | beamFilename = beamfile; |
593 | } | 593 | } |
594 | 594 | ||
595 | qWarning("Beaming: %s", beamFilename.latin1() ); | 595 | Opie::Core::owarn << "Beaming: " << beamFilename << oendl; |
596 | 596 | ||
597 | Ir *ir = new Ir( this ); | 597 | Ir *ir = new Ir( this ); |
598 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 598 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
599 | QString description = c.fullName(); | 599 | QString description = c.fullName(); |
600 | ir->send( beamFilename, description, "text/x-vCard" ); | 600 | ir->send( beamFilename, description, "text/x-vCard" ); |
601 | } | 601 | } |
602 | 602 | ||
603 | void AddressbookWindow::beamDone( Ir *ir ) | 603 | void AddressbookWindow::beamDone( Ir *ir ) |
604 | { | 604 | { |
605 | 605 | ||
606 | delete ir; | 606 | delete ir; |
607 | unlink( beamfile ); | 607 | unlink( beamfile ); |
608 | } | 608 | } |
609 | 609 | ||
610 | 610 | ||
611 | static void parseName( const QString& name, QString *first, QString *middle, | 611 | static void parseName( const QString& name, QString *first, QString *middle, |
612 | QString * last ) | 612 | QString * last ) |
613 | { | 613 | { |
614 | 614 | ||
615 | int comma = name.find ( "," ); | 615 | int comma = name.find ( "," ); |
616 | QString rest; | 616 | QString rest; |
617 | if ( comma > 0 ) { | 617 | if ( comma > 0 ) { |
618 | *last = name.left( comma ); | 618 | *last = name.left( comma ); |
619 | comma++; | 619 | comma++; |
620 | while ( comma < int(name.length()) && name[comma] == ' ' ) | 620 | while ( comma < int(name.length()) && name[comma] == ' ' ) |
621 | comma++; | 621 | comma++; |
622 | rest = name.mid( comma ); | 622 | rest = name.mid( comma ); |
623 | } else { | 623 | } else { |
624 | int space = name.findRev( ' ' ); | 624 | int space = name.findRev( ' ' ); |
625 | *last = name.mid( space+1 ); | 625 | *last = name.mid( space+1 ); |
626 | rest = name.left( space ); | 626 | rest = name.left( space ); |
627 | } | 627 | } |
628 | int space = rest.find( ' ' ); | 628 | int space = rest.find( ' ' ); |
629 | if ( space <= 0 ) { | 629 | if ( space <= 0 ) { |
630 | *first = rest; | 630 | *first = rest; |
631 | } else { | 631 | } else { |
632 | *first = rest.left( space ); | 632 | *first = rest.left( space ); |
633 | *middle = rest.mid( space+1 ); | 633 | *middle = rest.mid( space+1 ); |
634 | } | 634 | } |
635 | 635 | ||
636 | } | 636 | } |
637 | 637 | ||
638 | 638 | ||
639 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 639 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
640 | { | 640 | { |
641 | bool needShow = FALSE; | 641 | bool needShow = FALSE; |
642 | qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); | 642 | Opie::Core::owarn << "Receiving QCop-Call with message " << msg << oendl; |
643 | 643 | ||
644 | 644 | ||
645 | if (msg == "editPersonal()") { | 645 | if (msg == "editPersonal()") { |
646 | editPersonal(); | 646 | editPersonal(); |
647 | } else if (msg == "editPersonalAndClose()") { | 647 | } else if (msg == "editPersonalAndClose()") { |
648 | editPersonal(); | 648 | editPersonal(); |
649 | close(); | 649 | close(); |
650 | } else if ( msg == "addContact(QString,QString)" ) { | 650 | } else if ( msg == "addContact(QString,QString)" ) { |
651 | QDataStream stream(data,IO_ReadOnly); | 651 | QDataStream stream(data,IO_ReadOnly); |
652 | QString name, email; | 652 | QString name, email; |
653 | stream >> name >> email; | 653 | stream >> name >> email; |
654 | 654 | ||
655 | Opie::OPimContact cnt; | 655 | Opie::OPimContact cnt; |
656 | QString fn, mn, ln; | 656 | QString fn, mn, ln; |
657 | parseName( name, &fn, &mn, &ln ); | 657 | parseName( name, &fn, &mn, &ln ); |
658 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 658 | //Opie::Core::odebug << " " << fn << " - " << mn " - " << ln << oendl; |
659 | cnt.setFirstName( fn ); | 659 | cnt.setFirstName( fn ); |
660 | cnt.setMiddleName( mn ); | 660 | cnt.setMiddleName( mn ); |
661 | cnt.setLastName( ln ); | 661 | cnt.setLastName( ln ); |
662 | cnt.insertEmails( email ); | 662 | cnt.insertEmails( email ); |
663 | cnt.setDefaultEmail( email ); | 663 | cnt.setDefaultEmail( email ); |
664 | cnt.setFileAs(); | 664 | cnt.setFileAs(); |
665 | 665 | ||
666 | m_abView -> addEntry( cnt ); | 666 | m_abView -> addEntry( cnt ); |
667 | 667 | ||
668 | // :SXm_abView()->init( cnt ); | 668 | // :SXm_abView()->init( cnt ); |
669 | editEntry( EditEntry ); | 669 | editEntry( EditEntry ); |
670 | } else if ( msg == "beamBusinessCard()" ) { | 670 | } else if ( msg == "beamBusinessCard()" ) { |
671 | QString beamFilename = addressbookPersonalVCardName(); | 671 | QString beamFilename = addressbookPersonalVCardName(); |
672 | if ( !QFile::exists( beamFilename ) ) | 672 | if ( !QFile::exists( beamFilename ) ) |
673 | return; // can't beam a non-existent file | 673 | return; // can't beam a non-existent file |
674 | 674 | ||
675 | Ir *ir = new Ir( this ); | 675 | Ir *ir = new Ir( this ); |
676 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 676 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
677 | QString description = "mycard.vcf"; | 677 | QString description = "mycard.vcf"; |
678 | ir->send( beamFilename, description, "text/x-vCard" ); | 678 | ir->send( beamFilename, description, "text/x-vCard" ); |
679 | } else if ( msg == "show(int)" ) { | 679 | } else if ( msg == "show(int)" ) { |
680 | raise(); | 680 | raise(); |
681 | QDataStream stream(data,IO_ReadOnly); | 681 | QDataStream stream(data,IO_ReadOnly); |
682 | int uid; | 682 | int uid; |
683 | stream >> uid; | 683 | stream >> uid; |
684 | 684 | ||
685 | qWarning( "Showing uid: %d" , uid ); | 685 | Opie::Core::owarn << "Showing uid: " << uid << oendl; |
686 | 686 | ||
687 | // Deactivate Personal View.. | 687 | // Deactivate Personal View.. |
688 | if ( actionPersonal->isOn() ){ | 688 | if ( actionPersonal->isOn() ){ |
689 | actionPersonal->setOn( false ); | 689 | actionPersonal->setOn( false ); |
690 | slotPersonalView(); | 690 | slotPersonalView(); |
691 | } | 691 | } |
692 | 692 | ||
693 | // Reset category and show as card.. | 693 | // Reset category and show as card.. |
694 | m_abView -> setShowByCategory( QString::null ); | 694 | m_abView -> setShowByCategory( QString::null ); |
695 | m_abView -> setCurrentUid( uid ); | 695 | m_abView -> setCurrentUid( uid ); |
696 | slotViewSwitched ( AbView::CardView ); | 696 | slotViewSwitched ( AbView::CardView ); |
697 | 697 | ||
698 | needShow = true; | 698 | needShow = true; |
699 | 699 | ||
700 | 700 | ||
701 | } else if ( msg == "edit(int)" ) { | 701 | } else if ( msg == "edit(int)" ) { |
702 | QDataStream stream(data,IO_ReadOnly); | 702 | QDataStream stream(data,IO_ReadOnly); |
703 | int uid; | 703 | int uid; |
704 | stream >> uid; | 704 | stream >> uid; |
705 | 705 | ||
706 | // Deactivate Personal View.. | 706 | // Deactivate Personal View.. |
707 | if ( actionPersonal->isOn() ){ | 707 | if ( actionPersonal->isOn() ){ |
708 | actionPersonal->setOn( false ); | 708 | actionPersonal->setOn( false ); |
709 | slotPersonalView(); | 709 | slotPersonalView(); |
710 | } | 710 | } |
711 | 711 | ||
712 | // Reset category and edit.. | 712 | // Reset category and edit.. |
713 | m_abView -> setShowByCategory( QString::null ); | 713 | m_abView -> setShowByCategory( QString::null ); |
714 | m_abView -> setCurrentUid( uid ); | 714 | m_abView -> setCurrentUid( uid ); |
715 | slotViewEdit(); | 715 | slotViewEdit(); |
716 | } | 716 | } |
717 | 717 | ||
718 | if (needShow) | 718 | if (needShow) |
719 | QPEApplication::setKeepRunning(); | 719 | QPEApplication::setKeepRunning(); |
720 | 720 | ||
721 | } | 721 | } |
722 | 722 | ||
723 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 723 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
724 | { | 724 | { |
725 | Opie::OPimContact entry; | 725 | Opie::OPimContact entry; |
726 | if ( !abEditor ) { | 726 | if ( !abEditor ) { |
727 | abEditor = new ContactEditor( entry, this, "editor" ); | 727 | abEditor = new ContactEditor( entry, this, "editor" ); |
728 | } | 728 | } |
729 | if ( entryMode == EditEntry ) | 729 | if ( entryMode == EditEntry ) |
730 | abEditor->setEntry( m_abView -> currentEntry() ); | 730 | abEditor->setEntry( m_abView -> currentEntry() ); |
731 | else if ( entryMode == NewEntry ) | 731 | else if ( entryMode == NewEntry ) |
732 | abEditor->setEntry( entry ); | 732 | abEditor->setEntry( entry ); |
733 | // other things may change the caption. | 733 | // other things may change the caption. |
734 | abEditor->setCaption( tr("Edit Address") ); | 734 | abEditor->setCaption( tr("Edit Address") ); |
735 | 735 | ||
736 | // fix the foxus... | 736 | // fix the foxus... |
737 | abEditor->setNameFocus(); | 737 | abEditor->setNameFocus(); |
738 | if ( QPEApplication::execDialog( abEditor ) ) { | 738 | if ( QPEApplication::execDialog( abEditor ) ) { |
739 | setFocus(); | 739 | setFocus(); |
740 | if ( entryMode == NewEntry ) { | 740 | if ( entryMode == NewEntry ) { |
741 | Opie::OPimContact insertEntry = abEditor->entry(); | 741 | Opie::OPimContact insertEntry = abEditor->entry(); |
742 | insertEntry.assignUid(); | 742 | insertEntry.assignUid(); |
743 | m_abView -> addEntry( insertEntry ); | 743 | m_abView -> addEntry( insertEntry ); |
744 | m_abView -> setCurrentUid( insertEntry.uid() ); | 744 | m_abView -> setCurrentUid( insertEntry.uid() ); |
745 | } else { | 745 | } else { |
746 | Opie::OPimContact replEntry = abEditor->entry(); | 746 | Opie::OPimContact replEntry = abEditor->entry(); |
747 | 747 | ||
748 | if ( !replEntry.isValidUid() ) | 748 | if ( !replEntry.isValidUid() ) |
749 | replEntry.assignUid(); | 749 | replEntry.assignUid(); |
750 | 750 | ||
751 | m_abView -> replaceEntry( replEntry ); | 751 | m_abView -> replaceEntry( replEntry ); |
752 | } | 752 | } |
753 | } | 753 | } |
754 | // populateCategories(); | 754 | // populateCategories(); |
755 | 755 | ||
756 | } | 756 | } |
757 | 757 | ||
758 | void AddressbookWindow::editPersonal() | 758 | void AddressbookWindow::editPersonal() |
759 | { | 759 | { |
760 | Opie::OPimContact entry; | 760 | Opie::OPimContact entry; |
761 | 761 | ||
762 | // Switch to personal view if not selected | 762 | // Switch to personal view if not selected |
763 | // but take care of the menu, too | 763 | // but take care of the menu, too |
764 | if ( ! actionPersonal->isOn() ){ | 764 | if ( ! actionPersonal->isOn() ){ |
765 | qWarning("*** ++++"); | 765 | Opie::Core::owarn << "*** ++++" << oendl; |
766 | actionPersonal->setOn( true ); | 766 | actionPersonal->setOn( true ); |
767 | slotPersonalView(); | 767 | slotPersonalView(); |
768 | } | 768 | } |
769 | 769 | ||
770 | if ( !abEditor ) { | 770 | if ( !abEditor ) { |
771 | abEditor = new ContactEditor( entry, this, "editor" ); | 771 | abEditor = new ContactEditor( entry, this, "editor" ); |
772 | } | 772 | } |
773 | 773 | ||
774 | abEditor->setCaption(tr("Edit My Personal Details")); | 774 | abEditor->setCaption(tr("Edit My Personal Details")); |
775 | abEditor->setPersonalView( true ); | 775 | abEditor->setPersonalView( true ); |
776 | editEntry( EditEntry ); | 776 | editEntry( EditEntry ); |
777 | abEditor->setPersonalView( false ); | 777 | abEditor->setPersonalView( false ); |
778 | 778 | ||
779 | } | 779 | } |
780 | 780 | ||
781 | 781 | ||
782 | void AddressbookWindow::slotPersonalView() | 782 | void AddressbookWindow::slotPersonalView() |
783 | { | 783 | { |
784 | qWarning("slotPersonalView()"); | 784 | Opie::Core::owarn << "slotPersonalView()" << oendl; |
785 | if (!actionPersonal->isOn()) { | 785 | if (!actionPersonal->isOn()) { |
786 | // we just turned it off | 786 | // we just turned it off |
787 | qWarning("slotPersonalView()-> OFF"); | 787 | Opie::Core::owarn << "slotPersonalView()-> OFF" << oendl; |
788 | setCaption( tr("Contacts") ); | 788 | setCaption( tr("Contacts") ); |
789 | actionNew->setEnabled(TRUE); | 789 | actionNew->setEnabled(TRUE); |
790 | actionTrash->setEnabled(TRUE); | 790 | actionTrash->setEnabled(TRUE); |
791 | actionFind->setEnabled(TRUE); | 791 | actionFind->setEnabled(TRUE); |
792 | actionMail->setEnabled(TRUE); | 792 | actionMail->setEnabled(TRUE); |
793 | // slotUpdateToolbar(); | 793 | // slotUpdateToolbar(); |
794 | 794 | ||
795 | m_abView->showPersonal( false ); | 795 | m_abView->showPersonal( false ); |
796 | 796 | ||
797 | return; | 797 | return; |
798 | } | 798 | } |
799 | 799 | ||
800 | qWarning("slotPersonalView()-> ON"); | 800 | Opie::Core::owarn << "slotPersonalView()-> ON" << oendl; |
801 | // XXX need to disable some QActions. | 801 | // XXX need to disable some QActions. |
802 | actionNew->setEnabled(FALSE); | 802 | actionNew->setEnabled(FALSE); |
803 | actionTrash->setEnabled(FALSE); | 803 | actionTrash->setEnabled(FALSE); |
804 | actionFind->setEnabled(FALSE); | 804 | actionFind->setEnabled(FALSE); |
805 | actionMail->setEnabled(FALSE); | 805 | actionMail->setEnabled(FALSE); |
806 | 806 | ||
807 | setCaption( tr("Contacts - My Personal Details") ); | 807 | setCaption( tr("Contacts - My Personal Details") ); |
808 | 808 | ||
809 | m_abView->showPersonal( true ); | 809 | m_abView->showPersonal( true ); |
810 | 810 | ||
811 | } | 811 | } |
812 | 812 | ||
813 | 813 | ||
814 | void AddressbookWindow::listIsEmpty( bool empty ) | 814 | void AddressbookWindow::listIsEmpty( bool empty ) |
815 | { | 815 | { |
816 | if ( !empty ) { | 816 | if ( !empty ) { |
817 | deleteButton->setEnabled( TRUE ); | 817 | deleteButton->setEnabled( TRUE ); |
818 | } | 818 | } |
819 | } | 819 | } |
820 | 820 | ||
821 | void AddressbookWindow::reload() | 821 | void AddressbookWindow::reload() |
822 | { | 822 | { |
823 | syncing = FALSE; | 823 | syncing = FALSE; |
824 | m_abView->clear(); | 824 | m_abView->clear(); |
825 | m_abView->reload(); | 825 | m_abView->reload(); |
826 | } | 826 | } |
827 | 827 | ||
828 | void AddressbookWindow::flush() | 828 | void AddressbookWindow::flush() |
829 | { | 829 | { |
830 | syncing = TRUE; | 830 | syncing = TRUE; |
831 | m_abView->save(); | 831 | m_abView->save(); |
832 | } | 832 | } |
833 | 833 | ||
834 | 834 | ||
835 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 835 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
836 | { | 836 | { |
837 | if(active_view == AbView::CardView){ | 837 | if(active_view == AbView::CardView){ |
838 | slotViewSwitched( AbView::TableView ); | 838 | slotViewSwitched( AbView::TableView ); |
839 | e->ignore(); | 839 | e->ignore(); |
840 | return; | 840 | return; |
841 | } | 841 | } |
842 | if(syncing) { | 842 | if(syncing) { |
843 | /* shouldn't we save, I hear you say? well its already been set | 843 | /* shouldn't we save, I hear you say? well its already been set |
844 | so that an edit can not occur during a sync, and we flushed | 844 | so that an edit can not occur during a sync, and we flushed |
845 | at the start of the sync, so there is no need to save | 845 | at the start of the sync, so there is no need to save |
846 | Saving however itself would cause problems. */ | 846 | Saving however itself would cause problems. */ |
847 | e->accept(); | 847 | e->accept(); |
848 | return; | 848 | return; |
849 | } | 849 | } |
850 | //################## shouldn't always save | 850 | //################## shouldn't always save |
851 | // True, but the database handles this automatically ! (se) | 851 | // True, but the database handles this automatically ! (se) |
852 | if ( save() ) | 852 | if ( save() ) |
853 | e->accept(); | 853 | e->accept(); |
854 | else | 854 | else |
855 | e->ignore(); | 855 | e->ignore(); |
856 | } | 856 | } |
857 | 857 | ||
858 | /* | 858 | /* |
859 | Returns TRUE if it is OK to exit | 859 | Returns TRUE if it is OK to exit |
860 | */ | 860 | */ |
861 | 861 | ||
862 | bool AddressbookWindow::save() | 862 | bool AddressbookWindow::save() |
863 | { | 863 | { |
864 | if ( !m_abView->save() ) { | 864 | if ( !m_abView->save() ) { |
865 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 865 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
866 | tr("Unable to save information.\n" | 866 | tr("Unable to save information.\n" |
867 | "Free up some space\n" | 867 | "Free up some space\n" |
868 | "and try again.\n" | 868 | "and try again.\n" |
869 | "\nQuit anyway?"), | 869 | "\nQuit anyway?"), |
870 | QMessageBox::Yes|QMessageBox::Escape, | 870 | QMessageBox::Yes|QMessageBox::Escape, |
871 | QMessageBox::No|QMessageBox::Default ) | 871 | QMessageBox::No|QMessageBox::Default ) |
872 | != QMessageBox::No ) | 872 | != QMessageBox::No ) |
873 | return TRUE; | 873 | return TRUE; |
874 | else | 874 | else |
875 | return FALSE; | 875 | return FALSE; |
876 | } | 876 | } |
877 | return TRUE; | 877 | return TRUE; |
878 | } | 878 | } |
879 | 879 | ||
880 | #ifdef __DEBUG_RELEASE | 880 | #ifdef __DEBUG_RELEASE |
881 | void AddressbookWindow::slotSave() | 881 | void AddressbookWindow::slotSave() |
882 | { | 882 | { |
883 | save(); | 883 | save(); |
884 | } | 884 | } |
885 | #endif | 885 | #endif |
886 | 886 | ||
887 | 887 | ||
888 | void AddressbookWindow::slotNotFound() | 888 | void AddressbookWindow::slotNotFound() |
889 | { | 889 | { |
890 | qWarning("Got notfound signal!"); | 890 | Opie::Core::owarn << "Got not found signal!" << oendl; |
891 | QMessageBox::information( this, tr( "Not Found" ), | 891 | QMessageBox::information( this, tr( "Not Found" ), |
892 | "<qt>" + tr( "Unable to find a contact for this search pattern!" ) + "</qt>" ); | 892 | "<qt>" + tr( "Unable to find a contact for this search pattern!" ) + "</qt>" ); |
893 | 893 | ||
894 | 894 | ||
895 | } | 895 | } |
896 | void AddressbookWindow::slotWrapAround() | 896 | void AddressbookWindow::slotWrapAround() |
897 | { | 897 | { |
898 | qWarning("Got wrap signal!"); | 898 | Opie::Core::owarn << "Got wrap signal!" << oendl; |
899 | // if ( doNotifyWrapAround ) | 899 | // if ( doNotifyWrapAround ) |
900 | // QMessageBox::information( this, tr( "End of list" ), | 900 | // QMessageBox::information( this, tr( "End of list" ), |
901 | // tr( "End of list. Wrap around now...!" ) + "\n" ); | 901 | // tr( "End of list. Wrap around now...!" ) + "\n" ); |
902 | 902 | ||
903 | } | 903 | } |
904 | 904 | ||
905 | void AddressbookWindow::slotSetCategory( int c ) | 905 | void AddressbookWindow::slotSetCategory( int c ) |
906 | { | 906 | { |
907 | qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); | 907 | Opie::Core::owarn << "void AddressbookWindow::slotSetCategory( " << c << " ) from " |
908 | << catMenu->count() << oendl; | ||
908 | 909 | ||
909 | QString cat, book; | 910 | QString cat, book; |
910 | AbView::Views view = AbView::TableView; | 911 | AbView::Views view = AbView::TableView; |
911 | 912 | ||
912 | if ( c <= 0 ) | 913 | if ( c <= 0 ) |
913 | return; | 914 | return; |
914 | 915 | ||
915 | // Switch view | 916 | // Switch view |
916 | if ( c < 3 ) | 917 | if ( c < 3 ) |
917 | for ( unsigned int i = 1; i < 3; i++ ){ | 918 | for ( unsigned int i = 1; i < 3; i++ ){ |
918 | if ( catMenu ) | 919 | if ( catMenu ) |
919 | catMenu->setItemChecked( i, c == (int)i ); | 920 | catMenu->setItemChecked( i, c == (int)i ); |
920 | } | 921 | } |
921 | else | 922 | else |
922 | // Checkmark Category Menu Item Selected | 923 | // Checkmark Category Menu Item Selected |
923 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) | 924 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) |
924 | catMenu->setItemChecked( i, c == (int)i ); | 925 | catMenu->setItemChecked( i, c == (int)i ); |
925 | 926 | ||
926 | // Now switch to the selected category | 927 | // Now switch to the selected category |
927 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { | 928 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { |
928 | if (catMenu->isItemChecked( i )) { | 929 | if (catMenu->isItemChecked( i )) { |
929 | if ( i == 1 ){ // default List view | 930 | if ( i == 1 ){ // default List view |
930 | book = QString::null; | 931 | book = QString::null; |
931 | view = AbView::TableView; | 932 | view = AbView::TableView; |
932 | }else if ( i == 2 ){ | 933 | }else if ( i == 2 ){ |
933 | book = tr( "Cards" ); | 934 | book = tr( "Cards" ); |
934 | view = AbView::CardView; | 935 | view = AbView::CardView; |
935 | // }else if ( i == 3 ){ | 936 | // }else if ( i == 3 ){ |
936 | // book = tr( "Personal" ); | 937 | // book = tr( "Personal" ); |
937 | // view = AbView:: PersonalView; | 938 | // view = AbView:: PersonalView; |
938 | }else if ( i == 3 ){ // default All Categories | 939 | }else if ( i == 3 ){ // default All Categories |
939 | cat = QString::null; | 940 | cat = QString::null; |
940 | }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 |
941 | cat = "Unfiled"; | 942 | cat = "Unfiled"; |
942 | qWarning ("Unfiled selected!"); | 943 | Opie::Core::owarn << "Unfiled selected!" << oendl; |
943 | }else{ | 944 | }else{ |
944 | cat = m_abView->categories()[i - 4]; | 945 | cat = m_abView->categories()[i - 4]; |
945 | } | 946 | } |
946 | } | 947 | } |
947 | } | 948 | } |
948 | 949 | ||
949 | // Switch to the selected View | 950 | // Switch to the selected View |
950 | slotViewSwitched( view ); | 951 | slotViewSwitched( view ); |
951 | 952 | ||
952 | // Tell the view about the selected category | 953 | // Tell the view about the selected category |
953 | m_abView -> setShowByCategory( cat ); | 954 | m_abView -> setShowByCategory( cat ); |
954 | 955 | ||
955 | if ( book.isEmpty() ) | 956 | if ( book.isEmpty() ) |
956 | book = "List"; | 957 | book = "List"; |
957 | if ( cat.isEmpty() ) | 958 | if ( cat.isEmpty() ) |
958 | cat = "All"; | 959 | cat = "All"; |
959 | 960 | ||
960 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); | 961 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); |
961 | } | 962 | } |
962 | 963 | ||
963 | void AddressbookWindow::slotViewSwitched( int view ) | 964 | void AddressbookWindow::slotViewSwitched( int view ) |
964 | { | 965 | { |
965 | qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); | 966 | Opie::Core::owarn << "void AddressbookWindow::slotViewSwitched( " << view << " )" << oendl; |
966 | int menu = 0; | 967 | int menu = 0; |
967 | 968 | ||
968 | // Switch to selected view | 969 | // Switch to selected view |
969 | switch ( view ){ | 970 | switch ( view ){ |
970 | case AbView::TableView: | 971 | case AbView::TableView: |
971 | menu = 1; | 972 | menu = 1; |
972 | m_tableViewButton->setOn(true); | 973 | m_tableViewButton->setOn(true); |
973 | m_cardViewButton->setOn(false); | 974 | m_cardViewButton->setOn(false); |
974 | break; | 975 | break; |
975 | case AbView::CardView: | 976 | case AbView::CardView: |
976 | menu = 2; | 977 | menu = 2; |
977 | m_tableViewButton->setOn(false); | 978 | m_tableViewButton->setOn(false); |
978 | m_cardViewButton->setOn(true); | 979 | m_cardViewButton->setOn(true); |
979 | break; | 980 | break; |
980 | } | 981 | } |
981 | for ( unsigned int i = 1; i < 3; i++ ){ | 982 | for ( unsigned int i = 1; i < 3; i++ ){ |
982 | if ( catMenu ) | 983 | if ( catMenu ) |
983 | catMenu->setItemChecked( i, menu == (int)i ); | 984 | catMenu->setItemChecked( i, menu == (int)i ); |
984 | } | 985 | } |
985 | 986 | ||
986 | // Tell the view about the selected view | 987 | // Tell the view about the selected view |
987 | m_abView -> setShowToView ( (AbView::Views) view ); | 988 | m_abView -> setShowToView ( (AbView::Views) view ); |
988 | active_view = view; | 989 | active_view = view; |
989 | } | 990 | } |
990 | 991 | ||
991 | 992 | ||
992 | void AddressbookWindow::slotListView() | 993 | void AddressbookWindow::slotListView() |
993 | { | 994 | { |
994 | slotViewSwitched( AbView::TableView ); | 995 | slotViewSwitched( AbView::TableView ); |
995 | } | 996 | } |
996 | 997 | ||
997 | void AddressbookWindow::slotCardView() | 998 | void AddressbookWindow::slotCardView() |
998 | { | 999 | { |
999 | slotViewSwitched( AbView::CardView ); | 1000 | slotViewSwitched( AbView::CardView ); |
1000 | } | 1001 | } |
1001 | 1002 | ||
1002 | void AddressbookWindow::slotSetLetter( char c ) { | 1003 | void AddressbookWindow::slotSetLetter( char c ) { |
1003 | 1004 | ||
1004 | m_abView->setShowByLetter( c, m_config.letterPickerSearch() ); | 1005 | m_abView->setShowByLetter( c, m_config.letterPickerSearch() ); |
1005 | 1006 | ||
1006 | } | 1007 | } |
1007 | 1008 | ||
1008 | 1009 | ||
1009 | void AddressbookWindow::populateCategories() | 1010 | void AddressbookWindow::populateCategories() |
1010 | { | 1011 | { |
1011 | catMenu->clear(); | 1012 | catMenu->clear(); |
1012 | 1013 | ||
1013 | int id, rememberId; | 1014 | int id, rememberId; |
1014 | id = 1; | 1015 | id = 1; |
1015 | rememberId = 0; | 1016 | rememberId = 0; |
1016 | 1017 | ||
1017 | catMenu->insertItem( Resource::loadPixmap( "addressbook/listview" ), tr( "List" ), id++ ); | 1018 | catMenu->insertItem( Resource::loadPixmap( "addressbook/listview" ), tr( "List" ), id++ ); |
1018 | catMenu->insertItem( Resource::loadPixmap( "addressbook/cardview" ), tr( "Cards" ), id++ ); | 1019 | catMenu->insertItem( Resource::loadPixmap( "addressbook/cardview" ), tr( "Cards" ), id++ ); |
1019 | // catMenu->insertItem( tr( "Personal" ), id++ ); | 1020 | // catMenu->insertItem( tr( "Personal" ), id++ ); |
1020 | catMenu->insertSeparator(); | 1021 | catMenu->insertSeparator(); |
1021 | 1022 | ||
1022 | catMenu->insertItem( tr( "All" ), id++ ); | 1023 | catMenu->insertItem( tr( "All" ), id++ ); |
1023 | QStringList categories = m_abView->categories(); | 1024 | QStringList categories = m_abView->categories(); |
1024 | categories.append( tr( "Unfiled" ) ); | 1025 | categories.append( tr( "Unfiled" ) ); |
1025 | for ( QStringList::Iterator it = categories.begin(); | 1026 | for ( QStringList::Iterator it = categories.begin(); |
1026 | it != categories.end(); ++it ) { | 1027 | it != categories.end(); ++it ) { |
1027 | catMenu->insertItem( *it, id ); | 1028 | catMenu->insertItem( *it, id ); |
1028 | if ( *it == m_abView -> showCategory() ) | 1029 | if ( *it == m_abView -> showCategory() ) |
1029 | rememberId = id; | 1030 | rememberId = id; |
1030 | ++id; | 1031 | ++id; |
1031 | } | 1032 | } |
1032 | 1033 | ||
1033 | 1034 | ||
1034 | if ( m_abView -> showCategory().isEmpty() ) { | 1035 | if ( m_abView -> showCategory().isEmpty() ) { |
1035 | slotSetCategory( 3 ); | 1036 | slotSetCategory( 3 ); |
1036 | } | 1037 | } |
1037 | else { | 1038 | else { |
1038 | slotSetCategory( rememberId ); | 1039 | slotSetCategory( rememberId ); |
1039 | } | 1040 | } |
1040 | } | 1041 | } |
1041 | 1042 | ||
diff --git a/core/pim/addressbook/configdlg.cpp b/core/pim/addressbook/configdlg.cpp index 6c98b5d..094dbda 100644 --- a/core/pim/addressbook/configdlg.cpp +++ b/core/pim/addressbook/configdlg.cpp | |||
@@ -1,153 +1,154 @@ | |||
1 | #include "configdlg.h" | 1 | #include "configdlg.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | ||
3 | #include <opie2/opimcontact.h> | 4 | #include <opie2/opimcontact.h> |
4 | #include "opie2/opimcontactfields.h" | 5 | #include "opie2/opimcontactfields.h" |
5 | 6 | ||
6 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
7 | 8 | ||
8 | #include <qcheckbox.h> | 9 | #include <qcheckbox.h> |
9 | #include <qradiobutton.h> | 10 | #include <qradiobutton.h> |
10 | #include <qlistbox.h> | 11 | #include <qlistbox.h> |
11 | #include <qpushbutton.h> | 12 | #include <qpushbutton.h> |
12 | 13 | ||
13 | ConfigDlg::ConfigDlg( QWidget *parent, const char *name): | 14 | ConfigDlg::ConfigDlg( QWidget *parent, const char *name): |
14 | ConfigDlg_Base(parent, name, true ) | 15 | ConfigDlg_Base(parent, name, true ) |
15 | { | 16 | { |
16 | contFields = Opie::OPimContactFields::trfields(); | 17 | contFields = Opie::OPimContactFields::trfields(); |
17 | 18 | ||
18 | // We add all Fields into the Listbox | 19 | // We add all Fields into the Listbox |
19 | for (uint i=0; i < contFields.count(); i++) { | 20 | for (uint i=0; i < contFields.count(); i++) { |
20 | allFieldListBox->insertItem( contFields[i] ); | 21 | allFieldListBox->insertItem( contFields[i] ); |
21 | } | 22 | } |
22 | 23 | ||
23 | // Reset Widget Flags: This was not changeable by designer :( | 24 | // Reset Widget Flags: This was not changeable by designer :( |
24 | setWFlags ( WStyle_ContextHelp ); | 25 | setWFlags ( WStyle_ContextHelp ); |
25 | 26 | ||
26 | // Set Pics to Buttons and Tabs | 27 | // Set Pics to Buttons and Tabs |
27 | m_upButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/up" ) ) ); | 28 | m_upButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/up" ) ) ); |
28 | m_downButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/down" ) ) ); | 29 | m_downButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/down" ) ) ); |
29 | m_addButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/add" ) ) ); | 30 | m_addButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/add" ) ) ); |
30 | m_removeButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/sub" ) ) ); | 31 | m_removeButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/sub" ) ) ); |
31 | 32 | ||
32 | 33 | ||
33 | // Get the translation maps between Field ID and translated strings | 34 | // Get the translation maps between Field ID and translated strings |
34 | m_mapStrToID = Opie::OPimContactFields::trFieldsToId(); | 35 | m_mapStrToID = Opie::OPimContactFields::trFieldsToId(); |
35 | m_mapIDToStr = Opie::OPimContactFields::idToTrFields(); | 36 | m_mapIDToStr = Opie::OPimContactFields::idToTrFields(); |
36 | 37 | ||
37 | connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); | 38 | connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); |
38 | connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); | 39 | connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); |
39 | connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); | 40 | connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); |
40 | connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); | 41 | connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); |
41 | } | 42 | } |
42 | 43 | ||
43 | void ConfigDlg::slotItemUp() | 44 | void ConfigDlg::slotItemUp() |
44 | { | 45 | { |
45 | qWarning( "void ConfigDlg::slotItemUp()" ); | 46 | Opie::Core::owarn << "void ConfigDlg::slotItemUp()" << oendl; |
46 | 47 | ||
47 | int i = fieldListBox->currentItem(); | 48 | int i = fieldListBox->currentItem(); |
48 | if ( i > 0 ) { | 49 | if ( i > 0 ) { |
49 | QString item = fieldListBox->currentText(); | 50 | QString item = fieldListBox->currentText(); |
50 | fieldListBox->removeItem( i ); | 51 | fieldListBox->removeItem( i ); |
51 | fieldListBox->insertItem( item, i-1 ); | 52 | fieldListBox->insertItem( item, i-1 ); |
52 | fieldListBox->setCurrentItem( i-1 ); | 53 | fieldListBox->setCurrentItem( i-1 ); |
53 | } | 54 | } |
54 | 55 | ||
55 | } | 56 | } |
56 | 57 | ||
57 | void ConfigDlg::slotItemDown() | 58 | void ConfigDlg::slotItemDown() |
58 | { | 59 | { |
59 | qWarning( "void ConfigDlg::slotItemDown()" ); | 60 | Opie::Core::owarn << "void ConfigDlg::slotItemDown()" << oendl; |
60 | 61 | ||
61 | int i = fieldListBox->currentItem(); | 62 | int i = fieldListBox->currentItem(); |
62 | if ( i < (int)fieldListBox->count() - 1 ) { | 63 | if ( i < (int)fieldListBox->count() - 1 ) { |
63 | QString item = fieldListBox->currentText(); | 64 | QString item = fieldListBox->currentText(); |
64 | fieldListBox->removeItem( i ); | 65 | fieldListBox->removeItem( i ); |
65 | fieldListBox->insertItem( item, i+1 ); | 66 | fieldListBox->insertItem( item, i+1 ); |
66 | fieldListBox->setCurrentItem( i+1 ); | 67 | fieldListBox->setCurrentItem( i+1 ); |
67 | } | 68 | } |
68 | } | 69 | } |
69 | 70 | ||
70 | void ConfigDlg::slotItemAdd() | 71 | void ConfigDlg::slotItemAdd() |
71 | { | 72 | { |
72 | qWarning( "void ConfigDlg::slotItemAdd()" ); | 73 | Opie::Core::owarn << "void ConfigDlg::slotItemAdd()" << oendl; |
73 | 74 | ||
74 | int i = allFieldListBox->currentItem(); | 75 | int i = allFieldListBox->currentItem(); |
75 | if ( i > 0 ) { | 76 | if ( i > 0 ) { |
76 | QString item = allFieldListBox->currentText(); | 77 | QString item = allFieldListBox->currentText(); |
77 | qWarning("ADding %s", item.latin1()); | 78 | Opie::Core::owarn << "Adding " << item << oendl; |
78 | fieldListBox->insertItem( item ); | 79 | fieldListBox->insertItem( item ); |
79 | } | 80 | } |
80 | } | 81 | } |
81 | 82 | ||
82 | void ConfigDlg::slotItemRemove() | 83 | void ConfigDlg::slotItemRemove() |
83 | { | 84 | { |
84 | qWarning( "void ConfigDlg::slotItemRemove()" ); | 85 | Opie::Core::owarn << "void ConfigDlg::slotItemRemove()" << oendl; |
85 | 86 | ||
86 | int i = fieldListBox->currentItem(); | 87 | int i = fieldListBox->currentItem(); |
87 | if ( i > 0 ) { | 88 | if ( i > 0 ) { |
88 | fieldListBox->removeItem( i ); | 89 | fieldListBox->removeItem( i ); |
89 | } | 90 | } |
90 | } | 91 | } |
91 | 92 | ||
92 | void ConfigDlg::setConfig( const AbConfig& cnf ) | 93 | void ConfigDlg::setConfig( const AbConfig& cnf ) |
93 | { | 94 | { |
94 | m_config = cnf; | 95 | m_config = cnf; |
95 | 96 | ||
96 | m_useRegExp->setChecked( m_config.useRegExp() ); | 97 | m_useRegExp->setChecked( m_config.useRegExp() ); |
97 | m_useWildCard->setChecked( m_config.useWildCards() ); | 98 | m_useWildCard->setChecked( m_config.useWildCards() ); |
98 | m_useQtMail->setChecked( m_config.useQtMail() ); | 99 | m_useQtMail->setChecked( m_config.useQtMail() ); |
99 | m_useOpieMail->setChecked( m_config.useOpieMail() ); | 100 | m_useOpieMail->setChecked( m_config.useOpieMail() ); |
100 | m_useCaseSensitive->setChecked( m_config.beCaseSensitive() ); | 101 | m_useCaseSensitive->setChecked( m_config.beCaseSensitive() ); |
101 | 102 | ||
102 | switch( m_config.fontSize() ){ | 103 | switch( m_config.fontSize() ){ |
103 | case 0: | 104 | case 0: |
104 | m_smallFont->setChecked( true ); | 105 | m_smallFont->setChecked( true ); |
105 | m_normalFont->setChecked( false ); | 106 | m_normalFont->setChecked( false ); |
106 | m_largeFont->setChecked( false ); | 107 | m_largeFont->setChecked( false ); |
107 | break; | 108 | break; |
108 | case 1: | 109 | case 1: |
109 | m_smallFont->setChecked( false ); | 110 | m_smallFont->setChecked( false ); |
110 | m_normalFont->setChecked( true ); | 111 | m_normalFont->setChecked( true ); |
111 | m_largeFont->setChecked( false ); | 112 | m_largeFont->setChecked( false ); |
112 | break; | 113 | break; |
113 | case 2: | 114 | case 2: |
114 | m_smallFont->setChecked( false ); | 115 | m_smallFont->setChecked( false ); |
115 | m_normalFont->setChecked( false ); | 116 | m_normalFont->setChecked( false ); |
116 | m_largeFont->setChecked( true ); | 117 | m_largeFont->setChecked( true ); |
117 | break; | 118 | break; |
118 | } | 119 | } |
119 | 120 | ||
120 | for( uint i = 0; i < m_config.orderList().count(); i++ ) { | 121 | for( uint i = 0; i < m_config.orderList().count(); i++ ) { |
121 | fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); | 122 | fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); |
122 | } | 123 | } |
123 | 124 | ||
124 | m_fixedBars->setChecked( m_config.fixedBars() ); | 125 | m_fixedBars->setChecked( m_config.fixedBars() ); |
125 | m_moveBars->setChecked( !m_config.fixedBars() ); | 126 | m_moveBars->setChecked( !m_config.fixedBars() ); |
126 | } | 127 | } |
127 | 128 | ||
128 | AbConfig ConfigDlg::getConfig() | 129 | AbConfig ConfigDlg::getConfig() |
129 | { | 130 | { |
130 | m_config.setUseRegExp( m_useRegExp->isOn() ); | 131 | m_config.setUseRegExp( m_useRegExp->isOn() ); |
131 | m_config.setUseWildCards( m_useWildCard->isOn() ); | 132 | m_config.setUseWildCards( m_useWildCard->isOn() ); |
132 | m_config.setUseQtMail( m_useQtMail->isOn() ); | 133 | m_config.setUseQtMail( m_useQtMail->isOn() ); |
133 | m_config.setUseOpieMail( m_useOpieMail->isOn() ); | 134 | m_config.setUseOpieMail( m_useOpieMail->isOn() ); |
134 | m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() ); | 135 | m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() ); |
135 | 136 | ||
136 | if ( m_smallFont->isChecked() ) | 137 | if ( m_smallFont->isChecked() ) |
137 | m_config.setFontSize( 0 ); | 138 | m_config.setFontSize( 0 ); |
138 | if ( m_normalFont->isChecked() ) | 139 | if ( m_normalFont->isChecked() ) |
139 | m_config.setFontSize( 1 ); | 140 | m_config.setFontSize( 1 ); |
140 | if ( m_largeFont->isChecked() ) | 141 | if ( m_largeFont->isChecked() ) |
141 | m_config.setFontSize( 2 ); | 142 | m_config.setFontSize( 2 ); |
142 | 143 | ||
143 | QValueList<int> orderlist; | 144 | QValueList<int> orderlist; |
144 | for( int i = 0; i < (int)fieldListBox->count(); i++ ) { | 145 | for( int i = 0; i < (int)fieldListBox->count(); i++ ) { |
145 | orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] ); | 146 | orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] ); |
146 | } | 147 | } |
147 | m_config.setOrderList( orderlist ); | 148 | m_config.setOrderList( orderlist ); |
148 | 149 | ||
149 | m_config.setFixedBars( m_fixedBars->isChecked() ); | 150 | m_config.setFixedBars( m_fixedBars->isChecked() ); |
150 | 151 | ||
151 | return m_config; | 152 | return m_config; |
152 | } | 153 | } |
153 | 154 | ||
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 534666d..e496387 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -1,1747 +1,1751 @@ | |||
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 | 23 | ||
24 | #include <opie2/odebug.h> | ||
24 | #include <opie2/opimcontact.h> | 25 | #include <opie2/opimcontact.h> |
25 | 26 | ||
26 | #include <qpe/categoryselect.h> | 27 | #include <qpe/categoryselect.h> |
27 | #include <qpe/qpeapplication.h> | 28 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/qpedialog.h> | 29 | #include <qpe/qpedialog.h> |
29 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
30 | 31 | ||
31 | #include <qlabel.h> | 32 | #include <qlabel.h> |
32 | #include <qtabwidget.h> | 33 | #include <qtabwidget.h> |
33 | #include <qlayout.h> | 34 | #include <qlayout.h> |
34 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
35 | #include <qmultilineedit.h> | 36 | #include <qmultilineedit.h> |
36 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
37 | #include <qlistbox.h> | 38 | #include <qlistbox.h> |
38 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
39 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
40 | 41 | ||
41 | #include <assert.h> | 42 | #include <assert.h> |
42 | 43 | ||
43 | static inline bool containsAlphaNum( const QString &str ); | 44 | static inline bool containsAlphaNum( const QString &str ); |
44 | static inline bool constainsWhiteSpace( const QString &str ); | 45 | static inline bool constainsWhiteSpace( const QString &str ); |
45 | 46 | ||
46 | // helper functions, convert our comma delimited list to proper | 47 | // helper functions, convert our comma delimited list to proper |
47 | // file format... | 48 | // file format... |
48 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 49 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
49 | QString &strAll ); | 50 | QString &strAll ); |
50 | 51 | ||
51 | // helper convert from file format to comma delimited... | 52 | // helper convert from file format to comma delimited... |
52 | void parseEmailTo( const QString &strDefaultEmail, | 53 | void parseEmailTo( const QString &strDefaultEmail, |
53 | const QString &strOtherEmail, QString &strBack ); | 54 | const QString &strOtherEmail, QString &strBack ); |
54 | 55 | ||
55 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, | 56 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, |
56 | QWidget *parent, | 57 | QWidget *parent, |
57 | const char *name, | 58 | const char *name, |
58 | WFlags ) | 59 | WFlags ) |
59 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), | 60 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), |
60 | defaultEmailChooserPosition( -1 ), | 61 | defaultEmailChooserPosition( -1 ), |
61 | m_personalView ( false ), | 62 | m_personalView ( false ), |
62 | cmbDefaultEmail( 0 ), | 63 | cmbDefaultEmail( 0 ), |
63 | initializing ( false ) | 64 | initializing ( false ) |
64 | { | 65 | { |
65 | 66 | ||
66 | initializing = true; | 67 | initializing = true; |
67 | 68 | ||
68 | init(); | 69 | init(); |
69 | setEntry( entry ); | 70 | setEntry( entry ); |
70 | // cmbDefaultEmail = 0; | 71 | // cmbDefaultEmail = 0; |
71 | // defaultEmailChooserPosition = -1; | 72 | // defaultEmailChooserPosition = -1; |
72 | 73 | ||
73 | initializing = false; | 74 | initializing = false; |
74 | } | 75 | } |
75 | 76 | ||
76 | ContactEditor::~ContactEditor() { | 77 | ContactEditor::~ContactEditor() { |
77 | } | 78 | } |
78 | 79 | ||
79 | void ContactEditor::init() { | 80 | void ContactEditor::init() { |
80 | qWarning("init() START"); | 81 | Opie::Core::owarn << "init() START" << oendl; |
81 | 82 | ||
82 | uint i = 0; | 83 | uint i = 0; |
83 | 84 | ||
84 | QStringList trlChooserNames; | 85 | QStringList trlChooserNames; |
85 | 86 | ||
86 | for (i = 0; i <= 6; i++) { | 87 | for (i = 0; i <= 6; i++) { |
87 | slHomeAddress.append( "" ); | 88 | slHomeAddress.append( "" ); |
88 | slBusinessAddress.append( "" ); | 89 | slBusinessAddress.append( "" ); |
89 | } | 90 | } |
90 | 91 | ||
91 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); | 92 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); |
92 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); | 93 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); |
93 | slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); | 94 | slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); |
94 | trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); | 95 | trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); |
95 | 96 | ||
96 | // Ok, we have to remove elements from the list of dynamic entries | 97 | // Ok, we have to remove elements from the list of dynamic entries |
97 | // which are now stored in special (not dynamic) widgets.. | 98 | // which are now stored in special (not dynamic) widgets.. |
98 | // Otherwise we will get problems with field assignments! (se) | 99 | // Otherwise we will get problems with field assignments! (se) |
99 | slDynamicEntries.remove("Anniversary"); | 100 | slDynamicEntries.remove("Anniversary"); |
100 | slDynamicEntries.remove("Birthday"); | 101 | slDynamicEntries.remove("Birthday"); |
101 | slDynamicEntries.remove("Gender"); | 102 | slDynamicEntries.remove("Gender"); |
102 | 103 | ||
103 | // The same with translated fields.. But I will | 104 | // The same with translated fields.. But I will |
104 | // use the translation map to avoid mismatches.. | 105 | // use the translation map to avoid mismatches.. |
105 | QMap<int, QString> translMap = Opie::OPimContactFields::idToTrFields(); | 106 | QMap<int, QString> translMap = Opie::OPimContactFields::idToTrFields(); |
106 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); | 107 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); |
107 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); | 108 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); |
108 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); | 109 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); |
109 | 110 | ||
110 | // Last Check to be sure.. | 111 | // Last Check to be sure.. |
111 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); | 112 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); |
112 | assert( slChooserNames.count() == trlChooserNames.count() ); | 113 | assert( slChooserNames.count() == trlChooserNames.count() ); |
113 | 114 | ||
114 | for (i = 0; i < slChooserNames.count(); i++) | 115 | for (i = 0; i < slChooserNames.count(); i++) |
115 | slChooserValues.append(""); | 116 | slChooserValues.append(""); |
116 | 117 | ||
117 | 118 | ||
118 | QVBoxLayout *vb = new QVBoxLayout( this ); | 119 | QVBoxLayout *vb = new QVBoxLayout( this ); |
119 | 120 | ||
120 | tabMain = new QTabWidget( this ); | 121 | tabMain = new QTabWidget( this ); |
121 | vb->addWidget( tabMain ); | 122 | vb->addWidget( tabMain ); |
122 | 123 | ||
123 | QWidget *tabViewport = new QWidget ( tabMain ); | 124 | QWidget *tabViewport = new QWidget ( tabMain ); |
124 | 125 | ||
125 | vb = new QVBoxLayout( tabViewport ); | 126 | vb = new QVBoxLayout( tabViewport ); |
126 | 127 | ||
127 | svGeneral = new QScrollView( tabViewport ); | 128 | svGeneral = new QScrollView( tabViewport ); |
128 | vb->addWidget( svGeneral, 0, 0 ); | 129 | vb->addWidget( svGeneral, 0, 0 ); |
129 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 130 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
130 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); | 131 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); |
131 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); | 132 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); |
132 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 133 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
133 | 134 | ||
134 | QWidget *container = new QWidget( svGeneral->viewport() ); | 135 | QWidget *container = new QWidget( svGeneral->viewport() ); |
135 | svGeneral->addChild( container ); | 136 | svGeneral->addChild( container ); |
136 | 137 | ||
137 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 138 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); |
138 | gl->setResizeMode( QLayout::FreeResize ); | 139 | gl->setResizeMode( QLayout::FreeResize ); |
139 | 140 | ||
140 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 141 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
141 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); | 142 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); |
142 | gl->addWidget( btnFullName, 0, 0 ); | 143 | gl->addWidget( btnFullName, 0, 0 ); |
143 | txtFullName = new QLineEdit( container ); | 144 | txtFullName = new QLineEdit( container ); |
144 | 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\"" ) ); | 145 | 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\"" ) ); |
145 | gl->addWidget( txtFullName, 0, 1 ); | 146 | gl->addWidget( txtFullName, 0, 1 ); |
146 | 147 | ||
147 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 148 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
148 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); | 149 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); |
149 | gl->addWidget( l, 1, 0 ); | 150 | gl->addWidget( l, 1, 0 ); |
150 | txtJobTitle = new QLineEdit( container ); | 151 | txtJobTitle = new QLineEdit( container ); |
151 | QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); | 152 | QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); |
152 | gl->addWidget( txtJobTitle, 1, 1 ); | 153 | gl->addWidget( txtJobTitle, 1, 1 ); |
153 | 154 | ||
154 | l = new QLabel( tr("Suffix"), container ); | 155 | l = new QLabel( tr("Suffix"), container ); |
155 | QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); | 156 | QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); |
156 | gl->addWidget( l, 2, 0 ); | 157 | gl->addWidget( l, 2, 0 ); |
157 | txtSuffix = new QLineEdit( container ); | 158 | txtSuffix = new QLineEdit( container ); |
158 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); | 159 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); |
159 | gl->addWidget( txtSuffix, 2, 1 ); | 160 | gl->addWidget( txtSuffix, 2, 1 ); |
160 | 161 | ||
161 | l = new QLabel( tr( "Organization" ), container ); | 162 | l = new QLabel( tr( "Organization" ), container ); |
162 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); | 163 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); |
163 | gl->addWidget( l, 3, 0 ); | 164 | gl->addWidget( l, 3, 0 ); |
164 | txtOrganization = new QLineEdit( container ); | 165 | txtOrganization = new QLineEdit( container ); |
165 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); | 166 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); |
166 | gl->addWidget( txtOrganization, 3, 1 ); | 167 | gl->addWidget( txtOrganization, 3, 1 ); |
167 | 168 | ||
168 | // Chooser 1 | 169 | // Chooser 1 |
169 | cmbChooserField1 = new QComboBox( FALSE, container ); | 170 | cmbChooserField1 = new QComboBox( FALSE, container ); |
170 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); | 171 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); |
171 | cmbChooserField1->setMaximumWidth( 90 ); | 172 | cmbChooserField1->setMaximumWidth( 90 ); |
172 | gl->addWidget( cmbChooserField1, 4, 0 ); | 173 | gl->addWidget( cmbChooserField1, 4, 0 ); |
173 | // Textfield for chooser 1. | 174 | // Textfield for chooser 1. |
174 | // Now use Widgetstack to contain the textfield and the default-email combo ! | 175 | // Now use Widgetstack to contain the textfield and the default-email combo ! |
175 | m_widgetStack1 = new QWidgetStack( container ); | 176 | m_widgetStack1 = new QWidgetStack( container ); |
176 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); | 177 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); |
177 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); | 178 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); |
178 | gl->addWidget( m_widgetStack1, 4, 1 ); | 179 | gl->addWidget( m_widgetStack1, 4, 1 ); |
179 | m_widgetStack1 -> raiseWidget( TextField ); | 180 | m_widgetStack1 -> raiseWidget( TextField ); |
180 | 181 | ||
181 | // Chooser 2 | 182 | // Chooser 2 |
182 | cmbChooserField2 = new QComboBox( FALSE, container ); | 183 | cmbChooserField2 = new QComboBox( FALSE, container ); |
183 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); | 184 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); |
184 | cmbChooserField2->setMaximumWidth( 90 ); | 185 | cmbChooserField2->setMaximumWidth( 90 ); |
185 | gl->addWidget( cmbChooserField2, 5, 0 ); | 186 | gl->addWidget( cmbChooserField2, 5, 0 ); |
186 | // Textfield for chooser 2 | 187 | // Textfield for chooser 2 |
187 | // Now use WidgetStack to contain the textfield and the default-email combo! | 188 | // Now use WidgetStack to contain the textfield and the default-email combo! |
188 | m_widgetStack2 = new QWidgetStack( container ); | 189 | m_widgetStack2 = new QWidgetStack( container ); |
189 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); | 190 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); |
190 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); | 191 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); |
191 | gl->addWidget( m_widgetStack2, 5, 1 ); | 192 | gl->addWidget( m_widgetStack2, 5, 1 ); |
192 | m_widgetStack2 -> raiseWidget( TextField ); | 193 | m_widgetStack2 -> raiseWidget( TextField ); |
193 | 194 | ||
194 | // Chooser 3 | 195 | // Chooser 3 |
195 | cmbChooserField3 = new QComboBox( FALSE, container ); | 196 | cmbChooserField3 = new QComboBox( FALSE, container ); |
196 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); | 197 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); |
197 | cmbChooserField3->setMaximumWidth( 90 ); | 198 | cmbChooserField3->setMaximumWidth( 90 ); |
198 | gl->addWidget( cmbChooserField3, 6, 0 ); | 199 | gl->addWidget( cmbChooserField3, 6, 0 ); |
199 | // Textfield for chooser 2 | 200 | // Textfield for chooser 2 |
200 | // Now use WidgetStack to contain the textfield and the default-email combo! | 201 | // Now use WidgetStack to contain the textfield and the default-email combo! |
201 | m_widgetStack3 = new QWidgetStack( container ); | 202 | m_widgetStack3 = new QWidgetStack( container ); |
202 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); | 203 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); |
203 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); | 204 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); |
204 | gl->addWidget( m_widgetStack3, 6, 1 ); | 205 | gl->addWidget( m_widgetStack3, 6, 1 ); |
205 | m_widgetStack3 -> raiseWidget( TextField ); | 206 | m_widgetStack3 -> raiseWidget( TextField ); |
206 | 207 | ||
207 | l = new QLabel( tr( "File As" ), container ); | 208 | l = new QLabel( tr( "File As" ), container ); |
208 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); | 209 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); |
209 | gl->addWidget( l, 7, 0 ); | 210 | gl->addWidget( l, 7, 0 ); |
210 | cmbFileAs = new QComboBox( TRUE, container ); | 211 | cmbFileAs = new QComboBox( TRUE, container ); |
211 | gl->addWidget( cmbFileAs, 7, 1 ); | 212 | gl->addWidget( cmbFileAs, 7, 1 ); |
212 | 213 | ||
213 | labCat = new QLabel( tr( "Category" ), container ); | 214 | labCat = new QLabel( tr( "Category" ), container ); |
214 | gl->addWidget( labCat, 8, 0 ); | 215 | gl->addWidget( labCat, 8, 0 ); |
215 | cmbCat = new CategorySelect( container ); | 216 | cmbCat = new CategorySelect( container ); |
216 | gl->addWidget( cmbCat, 8, 1 ); | 217 | gl->addWidget( cmbCat, 8, 1 ); |
217 | labCat->show(); | 218 | labCat->show(); |
218 | cmbCat->show(); | 219 | cmbCat->show(); |
219 | 220 | ||
220 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 221 | btnNote = new QPushButton( tr( "Notes..." ), container ); |
221 | gl->addWidget( btnNote, 9, 1 ); | 222 | gl->addWidget( btnNote, 9, 1 ); |
222 | 223 | ||
223 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 224 | tabMain->insertTab( tabViewport, tr( "General" ) ); |
224 | 225 | ||
225 | tabViewport = new QWidget ( tabMain ); | 226 | tabViewport = new QWidget ( tabMain ); |
226 | 227 | ||
227 | vb = new QVBoxLayout( tabViewport ); | 228 | vb = new QVBoxLayout( tabViewport ); |
228 | 229 | ||
229 | svAddress = new QScrollView( tabViewport ); | 230 | svAddress = new QScrollView( tabViewport ); |
230 | vb->addWidget( svAddress, 0, 0 ); | 231 | vb->addWidget( svAddress, 0, 0 ); |
231 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 232 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
232 | svAddress->setFrameStyle( QFrame::NoFrame ); | 233 | svAddress->setFrameStyle( QFrame::NoFrame ); |
233 | 234 | ||
234 | container = new QWidget( svAddress->viewport() ); | 235 | container = new QWidget( svAddress->viewport() ); |
235 | svAddress->addChild( container ); | 236 | svAddress->addChild( container ); |
236 | 237 | ||
237 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 238 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
238 | 239 | ||
239 | cmbAddress = new QComboBox( FALSE, container ); | 240 | cmbAddress = new QComboBox( FALSE, container ); |
240 | cmbAddress->insertItem( tr( "Business" ) ); | 241 | cmbAddress->insertItem( tr( "Business" ) ); |
241 | cmbAddress->insertItem( tr( "Home" ) ); | 242 | cmbAddress->insertItem( tr( "Home" ) ); |
242 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 243 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
243 | 244 | ||
244 | l = new QLabel( tr( "Address" ), container ); | 245 | l = new QLabel( tr( "Address" ), container ); |
245 | gl->addWidget( l, 1, 0 ); | 246 | gl->addWidget( l, 1, 0 ); |
246 | txtAddress = new QLineEdit( container ); | 247 | txtAddress = new QLineEdit( container ); |
247 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 248 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
248 | 249 | ||
249 | l = new QLabel( tr( "City" ), container ); | 250 | l = new QLabel( tr( "City" ), container ); |
250 | gl->addWidget( l, 2, 0 ); | 251 | gl->addWidget( l, 2, 0 ); |
251 | txtCity = new QLineEdit( container ); | 252 | txtCity = new QLineEdit( container ); |
252 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 253 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
253 | 254 | ||
254 | l = new QLabel( tr( "State" ), container ); | 255 | l = new QLabel( tr( "State" ), container ); |
255 | gl->addWidget( l, 3, 0 ); | 256 | gl->addWidget( l, 3, 0 ); |
256 | txtState = new QLineEdit( container ); | 257 | txtState = new QLineEdit( container ); |
257 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 258 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
258 | 259 | ||
259 | l = new QLabel( tr( "Zip Code" ), container ); | 260 | l = new QLabel( tr( "Zip Code" ), container ); |
260 | gl->addWidget( l, 4, 0 ); | 261 | gl->addWidget( l, 4, 0 ); |
261 | txtZip = new QLineEdit( container ); | 262 | txtZip = new QLineEdit( container ); |
262 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 263 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
263 | 264 | ||
264 | l = new QLabel( tr( "Country" ), container ); | 265 | l = new QLabel( tr( "Country" ), container ); |
265 | gl->addWidget( l, 5, 0 ); | 266 | gl->addWidget( l, 5, 0 ); |
266 | cmbCountry = new QComboBox( TRUE, container ); | 267 | cmbCountry = new QComboBox( TRUE, container ); |
267 | cmbCountry->insertItem( tr( "" ) ); | 268 | cmbCountry->insertItem( tr( "" ) ); |
268 | cmbCountry->insertItem( tr ( "United States" ) ); | 269 | cmbCountry->insertItem( tr ( "United States" ) ); |
269 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 270 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
270 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); | 271 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); |
271 | cmbCountry->insertItem( tr ( "Albania" ) ); | 272 | cmbCountry->insertItem( tr ( "Albania" ) ); |
272 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 273 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
273 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 274 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
274 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 275 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
275 | cmbCountry->insertItem( tr ( "Angola" ) ); | 276 | cmbCountry->insertItem( tr ( "Angola" ) ); |
276 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 277 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
277 | cmbCountry->insertItem( tr ( "Antarctica" ) ); | 278 | cmbCountry->insertItem( tr ( "Antarctica" ) ); |
278 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 279 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
279 | cmbCountry->insertItem( tr ( "Armenia" ) ); | 280 | cmbCountry->insertItem( tr ( "Armenia" ) ); |
280 | cmbCountry->insertItem( tr ( "Aruba" ) ); | 281 | cmbCountry->insertItem( tr ( "Aruba" ) ); |
281 | cmbCountry->insertItem( tr ( "Australia" ) ); | 282 | cmbCountry->insertItem( tr ( "Australia" ) ); |
282 | cmbCountry->insertItem( tr ( "Austria" ) ); | 283 | cmbCountry->insertItem( tr ( "Austria" ) ); |
283 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); | 284 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); |
284 | cmbCountry->insertItem( tr ( "Bahamas" ) ); | 285 | cmbCountry->insertItem( tr ( "Bahamas" ) ); |
285 | cmbCountry->insertItem( tr ( "Bahrain" ) ); | 286 | cmbCountry->insertItem( tr ( "Bahrain" ) ); |
286 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); | 287 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); |
287 | cmbCountry->insertItem( tr ( "Barbados" ) ); | 288 | cmbCountry->insertItem( tr ( "Barbados" ) ); |
288 | cmbCountry->insertItem( tr ( "Belarus" ) ); | 289 | cmbCountry->insertItem( tr ( "Belarus" ) ); |
289 | cmbCountry->insertItem( tr ( "Belgium" ) ); | 290 | cmbCountry->insertItem( tr ( "Belgium" ) ); |
290 | cmbCountry->insertItem( tr ( "Belize" ) ); | 291 | cmbCountry->insertItem( tr ( "Belize" ) ); |
291 | cmbCountry->insertItem( tr ( "Benin" ) ); | 292 | cmbCountry->insertItem( tr ( "Benin" ) ); |
292 | cmbCountry->insertItem( tr ( "Bermuda" ) ); | 293 | cmbCountry->insertItem( tr ( "Bermuda" ) ); |
293 | cmbCountry->insertItem( tr ( "Bhutan" ) ); | 294 | cmbCountry->insertItem( tr ( "Bhutan" ) ); |
294 | cmbCountry->insertItem( tr ( "Bolivia" ) ); | 295 | cmbCountry->insertItem( tr ( "Bolivia" ) ); |
295 | cmbCountry->insertItem( tr ( "Botswana" ) ); | 296 | cmbCountry->insertItem( tr ( "Botswana" ) ); |
296 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); | 297 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); |
297 | cmbCountry->insertItem( tr ( "Brazil" ) ); | 298 | cmbCountry->insertItem( tr ( "Brazil" ) ); |
298 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); | 299 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); |
299 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); | 300 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); |
300 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); | 301 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); |
301 | cmbCountry->insertItem( tr ( "Burundi" ) ); | 302 | cmbCountry->insertItem( tr ( "Burundi" ) ); |
302 | cmbCountry->insertItem( tr ( "Cambodia" ) ); | 303 | cmbCountry->insertItem( tr ( "Cambodia" ) ); |
303 | cmbCountry->insertItem( tr ( "Cameroon" ) ); | 304 | cmbCountry->insertItem( tr ( "Cameroon" ) ); |
304 | cmbCountry->insertItem( tr ( "Canada" ) ); | 305 | cmbCountry->insertItem( tr ( "Canada" ) ); |
305 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); | 306 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); |
306 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); | 307 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); |
307 | cmbCountry->insertItem( tr ( "Chad" ) ); | 308 | cmbCountry->insertItem( tr ( "Chad" ) ); |
308 | cmbCountry->insertItem( tr ( "Chile" ) ); | 309 | cmbCountry->insertItem( tr ( "Chile" ) ); |
309 | cmbCountry->insertItem( tr ( "China" ) ); | 310 | cmbCountry->insertItem( tr ( "China" ) ); |
310 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); | 311 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); |
311 | cmbCountry->insertItem( tr ( "Colombia" ) ); | 312 | cmbCountry->insertItem( tr ( "Colombia" ) ); |
312 | cmbCountry->insertItem( tr ( "Comoros" ) ); | 313 | cmbCountry->insertItem( tr ( "Comoros" ) ); |
313 | cmbCountry->insertItem( tr ( "Congo" ) ); | 314 | cmbCountry->insertItem( tr ( "Congo" ) ); |
314 | cmbCountry->insertItem( tr ( "Cook Island" ) ); | 315 | cmbCountry->insertItem( tr ( "Cook Island" ) ); |
315 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); | 316 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); |
316 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); | 317 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); |
317 | cmbCountry->insertItem( tr ( "Croatia" ) ); | 318 | cmbCountry->insertItem( tr ( "Croatia" ) ); |
318 | cmbCountry->insertItem( tr ( "Cuba" ) ); | 319 | cmbCountry->insertItem( tr ( "Cuba" ) ); |
319 | cmbCountry->insertItem( tr ( "Cyprus" ) ); | 320 | cmbCountry->insertItem( tr ( "Cyprus" ) ); |
320 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); | 321 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); |
321 | cmbCountry->insertItem( tr ( "Denmark" ) ); | 322 | cmbCountry->insertItem( tr ( "Denmark" ) ); |
322 | cmbCountry->insertItem( tr ( "Djibouti" ) ); | 323 | cmbCountry->insertItem( tr ( "Djibouti" ) ); |
323 | cmbCountry->insertItem( tr ( "Dominica" ) ); | 324 | cmbCountry->insertItem( tr ( "Dominica" ) ); |
324 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); | 325 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); |
325 | cmbCountry->insertItem( tr ( "East Timor" ) ); | 326 | cmbCountry->insertItem( tr ( "East Timor" ) ); |
326 | cmbCountry->insertItem( tr ( "Ecuador" ) ); | 327 | cmbCountry->insertItem( tr ( "Ecuador" ) ); |
327 | cmbCountry->insertItem( tr ( "Egypt" ) ); | 328 | cmbCountry->insertItem( tr ( "Egypt" ) ); |
328 | cmbCountry->insertItem( tr ( "El Salvador" ) ); | 329 | cmbCountry->insertItem( tr ( "El Salvador" ) ); |
329 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); | 330 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); |
330 | cmbCountry->insertItem( tr ( "Eritrea" ) ); | 331 | cmbCountry->insertItem( tr ( "Eritrea" ) ); |
331 | cmbCountry->insertItem( tr ( "Estonia" ) ); | 332 | cmbCountry->insertItem( tr ( "Estonia" ) ); |
332 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); | 333 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); |
333 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); | 334 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); |
334 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); | 335 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); |
335 | cmbCountry->insertItem( tr ( "Fiji" ) ); | 336 | cmbCountry->insertItem( tr ( "Fiji" ) ); |
336 | cmbCountry->insertItem( tr ( "Finland" ) ); | 337 | cmbCountry->insertItem( tr ( "Finland" ) ); |
337 | cmbCountry->insertItem( tr ( "France" ) ); | 338 | cmbCountry->insertItem( tr ( "France" ) ); |
338 | cmbCountry->insertItem( tr ( "French Guiana" ) ); | 339 | cmbCountry->insertItem( tr ( "French Guiana" ) ); |
339 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); | 340 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); |
340 | cmbCountry->insertItem( tr ( "Gabon" ) ); | 341 | cmbCountry->insertItem( tr ( "Gabon" ) ); |
341 | cmbCountry->insertItem( tr ( "Gambia" ) ); | 342 | cmbCountry->insertItem( tr ( "Gambia" ) ); |
342 | cmbCountry->insertItem( tr ( "Georgia" ) ); | 343 | cmbCountry->insertItem( tr ( "Georgia" ) ); |
343 | cmbCountry->insertItem( tr ( "Germany" ) ); | 344 | cmbCountry->insertItem( tr ( "Germany" ) ); |
344 | cmbCountry->insertItem( tr ( "Ghana" ) ); | 345 | cmbCountry->insertItem( tr ( "Ghana" ) ); |
345 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); | 346 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); |
346 | cmbCountry->insertItem( tr ( "Greece" ) ); | 347 | cmbCountry->insertItem( tr ( "Greece" ) ); |
347 | cmbCountry->insertItem( tr ( "Greenland" ) ); | 348 | cmbCountry->insertItem( tr ( "Greenland" ) ); |
348 | cmbCountry->insertItem( tr ( "Grenada" ) ); | 349 | cmbCountry->insertItem( tr ( "Grenada" ) ); |
349 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); | 350 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); |
350 | cmbCountry->insertItem( tr ( "Guam" ) ); | 351 | cmbCountry->insertItem( tr ( "Guam" ) ); |
351 | cmbCountry->insertItem( tr ( "Guatemala" ) ); | 352 | cmbCountry->insertItem( tr ( "Guatemala" ) ); |
352 | cmbCountry->insertItem( tr ( "Guinea" ) ); | 353 | cmbCountry->insertItem( tr ( "Guinea" ) ); |
353 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); | 354 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); |
354 | cmbCountry->insertItem( tr ( "Guyana" ) ); | 355 | cmbCountry->insertItem( tr ( "Guyana" ) ); |
355 | cmbCountry->insertItem( tr ( "Haiti" ) ); | 356 | cmbCountry->insertItem( tr ( "Haiti" ) ); |
356 | cmbCountry->insertItem( tr ( "Holy See" ) ); | 357 | cmbCountry->insertItem( tr ( "Holy See" ) ); |
357 | cmbCountry->insertItem( tr ( "Honduras" ) ); | 358 | cmbCountry->insertItem( tr ( "Honduras" ) ); |
358 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); | 359 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); |
359 | cmbCountry->insertItem( tr ( "Hungary" ) ); | 360 | cmbCountry->insertItem( tr ( "Hungary" ) ); |
360 | cmbCountry->insertItem( tr ( "Iceland" ) ); | 361 | cmbCountry->insertItem( tr ( "Iceland" ) ); |
361 | cmbCountry->insertItem( tr ( "India" ) ); | 362 | cmbCountry->insertItem( tr ( "India" ) ); |
362 | cmbCountry->insertItem( tr ( "Indonesia" ) ); | 363 | cmbCountry->insertItem( tr ( "Indonesia" ) ); |
363 | cmbCountry->insertItem( tr ( "Ireland" ) ); | 364 | cmbCountry->insertItem( tr ( "Ireland" ) ); |
364 | cmbCountry->insertItem( tr ( "Israel" ) ); | 365 | cmbCountry->insertItem( tr ( "Israel" ) ); |
365 | cmbCountry->insertItem( tr ( "Italy" ) ); | 366 | cmbCountry->insertItem( tr ( "Italy" ) ); |
366 | cmbCountry->insertItem( tr ( "Jamaica" ) ); | 367 | cmbCountry->insertItem( tr ( "Jamaica" ) ); |
367 | cmbCountry->insertItem( tr ( "Japan" ) ); | 368 | cmbCountry->insertItem( tr ( "Japan" ) ); |
368 | cmbCountry->insertItem( tr ( "Jordan" ) ); | 369 | cmbCountry->insertItem( tr ( "Jordan" ) ); |
369 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); | 370 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); |
370 | cmbCountry->insertItem( tr ( "Kenya" ) ); | 371 | cmbCountry->insertItem( tr ( "Kenya" ) ); |
371 | cmbCountry->insertItem( tr ( "Kiribati" ) ); | 372 | cmbCountry->insertItem( tr ( "Kiribati" ) ); |
372 | cmbCountry->insertItem( tr ( "Korea" ) ); | 373 | cmbCountry->insertItem( tr ( "Korea" ) ); |
373 | cmbCountry->insertItem( tr ( "Kuwait" ) ); | 374 | cmbCountry->insertItem( tr ( "Kuwait" ) ); |
374 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); | 375 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); |
375 | cmbCountry->insertItem( tr ( "Laos" ) ); | 376 | cmbCountry->insertItem( tr ( "Laos" ) ); |
376 | cmbCountry->insertItem( tr ( "Latvia" ) ); | 377 | cmbCountry->insertItem( tr ( "Latvia" ) ); |
377 | cmbCountry->insertItem( tr ( "Lebanon" ) ); | 378 | cmbCountry->insertItem( tr ( "Lebanon" ) ); |
378 | cmbCountry->insertItem( tr ( "Lesotho" ) ); | 379 | cmbCountry->insertItem( tr ( "Lesotho" ) ); |
379 | cmbCountry->insertItem( tr ( "Liberia" ) ); | 380 | cmbCountry->insertItem( tr ( "Liberia" ) ); |
380 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); | 381 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); |
381 | cmbCountry->insertItem( tr ( "Lithuania" ) ); | 382 | cmbCountry->insertItem( tr ( "Lithuania" ) ); |
382 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); | 383 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); |
383 | cmbCountry->insertItem( tr ( "Macau" ) ); | 384 | cmbCountry->insertItem( tr ( "Macau" ) ); |
384 | cmbCountry->insertItem( tr ( "Macedonia" ) ); | 385 | cmbCountry->insertItem( tr ( "Macedonia" ) ); |
385 | cmbCountry->insertItem( tr ( "Madagascar" ) ); | 386 | cmbCountry->insertItem( tr ( "Madagascar" ) ); |
386 | cmbCountry->insertItem( tr ( "Malawi" ) ); | 387 | cmbCountry->insertItem( tr ( "Malawi" ) ); |
387 | cmbCountry->insertItem( tr ( "Malaysia" ) ); | 388 | cmbCountry->insertItem( tr ( "Malaysia" ) ); |
388 | cmbCountry->insertItem( tr ( "Maldives" ) ); | 389 | cmbCountry->insertItem( tr ( "Maldives" ) ); |
389 | cmbCountry->insertItem( tr ( "Mali" ) ); | 390 | cmbCountry->insertItem( tr ( "Mali" ) ); |
390 | cmbCountry->insertItem( tr ( "Malta" ) ); | 391 | cmbCountry->insertItem( tr ( "Malta" ) ); |
391 | cmbCountry->insertItem( tr ( "Martinique" ) ); | 392 | cmbCountry->insertItem( tr ( "Martinique" ) ); |
392 | cmbCountry->insertItem( tr ( "Mauritania" ) ); | 393 | cmbCountry->insertItem( tr ( "Mauritania" ) ); |
393 | cmbCountry->insertItem( tr ( "Mauritius" ) ); | 394 | cmbCountry->insertItem( tr ( "Mauritius" ) ); |
394 | cmbCountry->insertItem( tr ( "Mayotte" ) ); | 395 | cmbCountry->insertItem( tr ( "Mayotte" ) ); |
395 | cmbCountry->insertItem( tr ( "Mexico" ) ); | 396 | cmbCountry->insertItem( tr ( "Mexico" ) ); |
396 | cmbCountry->insertItem( tr ( "Micronesia" ) ); | 397 | cmbCountry->insertItem( tr ( "Micronesia" ) ); |
397 | cmbCountry->insertItem( tr ( "Moldova" ) ); | 398 | cmbCountry->insertItem( tr ( "Moldova" ) ); |
398 | cmbCountry->insertItem( tr ( "Monaco" ) ); | 399 | cmbCountry->insertItem( tr ( "Monaco" ) ); |
399 | cmbCountry->insertItem( tr ( "Mongolia" ) ); | 400 | cmbCountry->insertItem( tr ( "Mongolia" ) ); |
400 | cmbCountry->insertItem( tr ( "Montserrat" ) ); | 401 | cmbCountry->insertItem( tr ( "Montserrat" ) ); |
401 | cmbCountry->insertItem( tr ( "Morocco" ) ); | 402 | cmbCountry->insertItem( tr ( "Morocco" ) ); |
402 | cmbCountry->insertItem( tr ( "Mozambique" ) ); | 403 | cmbCountry->insertItem( tr ( "Mozambique" ) ); |
403 | cmbCountry->insertItem( tr ( "Myanmar" ) ); | 404 | cmbCountry->insertItem( tr ( "Myanmar" ) ); |
404 | cmbCountry->insertItem( tr ( "Namibia" ) ); | 405 | cmbCountry->insertItem( tr ( "Namibia" ) ); |
405 | cmbCountry->insertItem( tr ( "Nauru" ) ); | 406 | cmbCountry->insertItem( tr ( "Nauru" ) ); |
406 | cmbCountry->insertItem( tr ( "Nepal" ) ); | 407 | cmbCountry->insertItem( tr ( "Nepal" ) ); |
407 | cmbCountry->insertItem( tr ( "Netherlands" ) ); | 408 | cmbCountry->insertItem( tr ( "Netherlands" ) ); |
408 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); | 409 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); |
409 | cmbCountry->insertItem( tr ( "New Zealand" ) ); | 410 | cmbCountry->insertItem( tr ( "New Zealand" ) ); |
410 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); | 411 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); |
411 | cmbCountry->insertItem( tr ( "Niger" ) ); | 412 | cmbCountry->insertItem( tr ( "Niger" ) ); |
412 | cmbCountry->insertItem( tr ( "Nigeria" ) ); | 413 | cmbCountry->insertItem( tr ( "Nigeria" ) ); |
413 | cmbCountry->insertItem( tr ( "Niue" ) ); | 414 | cmbCountry->insertItem( tr ( "Niue" ) ); |
414 | cmbCountry->insertItem( tr ( "Norway" ) ); | 415 | cmbCountry->insertItem( tr ( "Norway" ) ); |
415 | cmbCountry->insertItem( tr ( "Oman" ) ); | 416 | cmbCountry->insertItem( tr ( "Oman" ) ); |
416 | cmbCountry->insertItem( tr ( "Pakistan" ) ); | 417 | cmbCountry->insertItem( tr ( "Pakistan" ) ); |
417 | cmbCountry->insertItem( tr ( "Palau" ) ); | 418 | cmbCountry->insertItem( tr ( "Palau" ) ); |
418 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); | 419 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); |
419 | cmbCountry->insertItem( tr ( "Panama" ) ); | 420 | cmbCountry->insertItem( tr ( "Panama" ) ); |
420 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); | 421 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); |
421 | cmbCountry->insertItem( tr ( "Paraguay" ) ); | 422 | cmbCountry->insertItem( tr ( "Paraguay" ) ); |
422 | cmbCountry->insertItem( tr ( "Peru" ) ); | 423 | cmbCountry->insertItem( tr ( "Peru" ) ); |
423 | cmbCountry->insertItem( tr ( "Philippines" ) ); | 424 | cmbCountry->insertItem( tr ( "Philippines" ) ); |
424 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); | 425 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); |
425 | cmbCountry->insertItem( tr ( "Poland" ) ); | 426 | cmbCountry->insertItem( tr ( "Poland" ) ); |
426 | cmbCountry->insertItem( tr ( "Portugal" ) ); | 427 | cmbCountry->insertItem( tr ( "Portugal" ) ); |
427 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); | 428 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); |
428 | cmbCountry->insertItem( tr ( "Qatar" ) ); | 429 | cmbCountry->insertItem( tr ( "Qatar" ) ); |
429 | cmbCountry->insertItem( tr ( "Reunion" ) ); | 430 | cmbCountry->insertItem( tr ( "Reunion" ) ); |
430 | cmbCountry->insertItem( tr ( "Romania" ) ); | 431 | cmbCountry->insertItem( tr ( "Romania" ) ); |
431 | cmbCountry->insertItem( tr ( "Russia" ) ); | 432 | cmbCountry->insertItem( tr ( "Russia" ) ); |
432 | cmbCountry->insertItem( tr ( "Rwanda" ) ); | 433 | cmbCountry->insertItem( tr ( "Rwanda" ) ); |
433 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); | 434 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); |
434 | cmbCountry->insertItem( tr ( "Samoa" ) ); | 435 | cmbCountry->insertItem( tr ( "Samoa" ) ); |
435 | cmbCountry->insertItem( tr ( "San Marino" ) ); | 436 | cmbCountry->insertItem( tr ( "San Marino" ) ); |
436 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); | 437 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); |
437 | cmbCountry->insertItem( tr ( "Senegal" ) ); | 438 | cmbCountry->insertItem( tr ( "Senegal" ) ); |
438 | cmbCountry->insertItem( tr ( "Seychelles" ) ); | 439 | cmbCountry->insertItem( tr ( "Seychelles" ) ); |
439 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); | 440 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); |
440 | cmbCountry->insertItem( tr ( "Singapore" ) ); | 441 | cmbCountry->insertItem( tr ( "Singapore" ) ); |
441 | cmbCountry->insertItem( tr ( "Slovakia" ) ); | 442 | cmbCountry->insertItem( tr ( "Slovakia" ) ); |
442 | cmbCountry->insertItem( tr ( "Slovenia" ) ); | 443 | cmbCountry->insertItem( tr ( "Slovenia" ) ); |
443 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); | 444 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); |
444 | cmbCountry->insertItem( tr ( "Somalia" ) ); | 445 | cmbCountry->insertItem( tr ( "Somalia" ) ); |
445 | cmbCountry->insertItem( tr ( "South Africa" ) ); | 446 | cmbCountry->insertItem( tr ( "South Africa" ) ); |
446 | cmbCountry->insertItem( tr ( "Spain" ) ); | 447 | cmbCountry->insertItem( tr ( "Spain" ) ); |
447 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); | 448 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); |
448 | cmbCountry->insertItem( tr ( "St. Helena" ) ); | 449 | cmbCountry->insertItem( tr ( "St. Helena" ) ); |
449 | cmbCountry->insertItem( tr ( "Sudan" ) ); | 450 | cmbCountry->insertItem( tr ( "Sudan" ) ); |
450 | cmbCountry->insertItem( tr ( "Suriname" ) ); | 451 | cmbCountry->insertItem( tr ( "Suriname" ) ); |
451 | cmbCountry->insertItem( tr ( "Swaziland" ) ); | 452 | cmbCountry->insertItem( tr ( "Swaziland" ) ); |
452 | cmbCountry->insertItem( tr ( "Sweden" ) ); | 453 | cmbCountry->insertItem( tr ( "Sweden" ) ); |
453 | cmbCountry->insertItem( tr ( "Switzerland" ) ); | 454 | cmbCountry->insertItem( tr ( "Switzerland" ) ); |
454 | cmbCountry->insertItem( tr ( "Taiwan" ) ); | 455 | cmbCountry->insertItem( tr ( "Taiwan" ) ); |
455 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); | 456 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); |
456 | cmbCountry->insertItem( tr ( "Tanzania" ) ); | 457 | cmbCountry->insertItem( tr ( "Tanzania" ) ); |
457 | cmbCountry->insertItem( tr ( "Thailand" ) ); | 458 | cmbCountry->insertItem( tr ( "Thailand" ) ); |
458 | cmbCountry->insertItem( tr ( "Togo" ) ); | 459 | cmbCountry->insertItem( tr ( "Togo" ) ); |
459 | cmbCountry->insertItem( tr ( "Tokelau" ) ); | 460 | cmbCountry->insertItem( tr ( "Tokelau" ) ); |
460 | cmbCountry->insertItem( tr ( "Tonga" ) ); | 461 | cmbCountry->insertItem( tr ( "Tonga" ) ); |
461 | cmbCountry->insertItem( tr ( "Tunisia" ) ); | 462 | cmbCountry->insertItem( tr ( "Tunisia" ) ); |
462 | cmbCountry->insertItem( tr ( "Turkey" ) ); | 463 | cmbCountry->insertItem( tr ( "Turkey" ) ); |
463 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); | 464 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); |
464 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); | 465 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); |
465 | cmbCountry->insertItem( tr ( "Uganda" ) ); | 466 | cmbCountry->insertItem( tr ( "Uganda" ) ); |
466 | cmbCountry->insertItem( tr ( "Ukraine" ) ); | 467 | cmbCountry->insertItem( tr ( "Ukraine" ) ); |
467 | cmbCountry->insertItem( tr ( "Uruguay" ) ); | 468 | cmbCountry->insertItem( tr ( "Uruguay" ) ); |
468 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); | 469 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); |
469 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); | 470 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); |
470 | cmbCountry->insertItem( tr ( "Venezuela" ) ); | 471 | cmbCountry->insertItem( tr ( "Venezuela" ) ); |
471 | cmbCountry->insertItem( tr ( "Vietnam" ) ); | 472 | cmbCountry->insertItem( tr ( "Vietnam" ) ); |
472 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); | 473 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); |
473 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); | 474 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); |
474 | cmbCountry->insertItem( tr ( "Yemen" ) ); | 475 | cmbCountry->insertItem( tr ( "Yemen" ) ); |
475 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); | 476 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); |
476 | cmbCountry->insertItem( tr ( "Zambia" ) ); | 477 | cmbCountry->insertItem( tr ( "Zambia" ) ); |
477 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); | 478 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); |
478 | if (cmbCountry->listBox()!=0) | 479 | if (cmbCountry->listBox()!=0) |
479 | cmbCountry->listBox()->sort(); | 480 | cmbCountry->listBox()->sort(); |
480 | 481 | ||
481 | cmbCountry->setMaximumWidth( 135 ); | 482 | cmbCountry->setMaximumWidth( 135 ); |
482 | 483 | ||
483 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 484 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
484 | 485 | ||
485 | // Chooser 4 | 486 | // Chooser 4 |
486 | cmbChooserField4 = new QComboBox( FALSE, container ); | 487 | cmbChooserField4 = new QComboBox( FALSE, container ); |
487 | cmbChooserField4->setMaximumWidth( 90 ); | 488 | cmbChooserField4->setMaximumWidth( 90 ); |
488 | gl->addWidget( cmbChooserField4, 6, 0 ); | 489 | gl->addWidget( cmbChooserField4, 6, 0 ); |
489 | // Textfield for chooser 2 | 490 | // Textfield for chooser 2 |
490 | // Now use WidgetStack to contain the textfield and the default-email combo! | 491 | // Now use WidgetStack to contain the textfield and the default-email combo! |
491 | m_widgetStack4 = new QWidgetStack( container ); | 492 | m_widgetStack4 = new QWidgetStack( container ); |
492 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); | 493 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); |
493 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); | 494 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); |
494 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); | 495 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); |
495 | m_widgetStack4 -> raiseWidget( TextField ); | 496 | m_widgetStack4 -> raiseWidget( TextField ); |
496 | 497 | ||
497 | QSpacerItem *space = new QSpacerItem(1,1, | 498 | QSpacerItem *space = new QSpacerItem(1,1, |
498 | QSizePolicy::Maximum, | 499 | QSizePolicy::Maximum, |
499 | QSizePolicy::MinimumExpanding ); | 500 | QSizePolicy::MinimumExpanding ); |
500 | gl->addItem( space, 7, 0 ); | 501 | gl->addItem( space, 7, 0 ); |
501 | 502 | ||
502 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 503 | tabMain->insertTab( tabViewport, tr( "Address" ) ); |
503 | 504 | ||
504 | tabViewport = new QWidget ( tabMain ); | 505 | tabViewport = new QWidget ( tabMain ); |
505 | 506 | ||
506 | vb = new QVBoxLayout( tabViewport ); | 507 | vb = new QVBoxLayout( tabViewport ); |
507 | 508 | ||
508 | svDetails = new QScrollView( tabViewport ); | 509 | svDetails = new QScrollView( tabViewport ); |
509 | vb->addWidget( svDetails, 0, 0 ); | 510 | vb->addWidget( svDetails, 0, 0 ); |
510 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 511 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
511 | svDetails->setFrameStyle( QFrame::NoFrame ); | 512 | svDetails->setFrameStyle( QFrame::NoFrame ); |
512 | 513 | ||
513 | container = new QWidget( svDetails->viewport() ); | 514 | container = new QWidget( svDetails->viewport() ); |
514 | svDetails->addChild( container ); | 515 | svDetails->addChild( container ); |
515 | 516 | ||
516 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 517 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
517 | 518 | ||
518 | int counter = 0; | 519 | int counter = 0; |
519 | 520 | ||
520 | // Birthday | 521 | // Birthday |
521 | QHBox* hBox = new QHBox( container ); | 522 | QHBox* hBox = new QHBox( container ); |
522 | l = new QLabel( tr("Birthday"), container ); | 523 | l = new QLabel( tr("Birthday"), container ); |
523 | gl->addWidget( l, counter, 0 ); | 524 | gl->addWidget( l, counter, 0 ); |
524 | 525 | ||
525 | QPopupMenu* m1 = new QPopupMenu( container ); | 526 | QPopupMenu* m1 = new QPopupMenu( container ); |
526 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | 527 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); |
527 | m1->insertItem( birthdayPicker ); | 528 | m1->insertItem( birthdayPicker ); |
528 | 529 | ||
529 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 530 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
530 | birthdayButton->setPopup( m1 ); | 531 | birthdayButton->setPopup( m1 ); |
531 | birthdayButton->setPopupDelay(0); | 532 | birthdayButton->setPopupDelay(0); |
532 | 533 | ||
533 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 534 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
534 | tr( "Delete" ), | 535 | tr( "Delete" ), |
535 | hBox, 0 ); | 536 | hBox, 0 ); |
536 | 537 | ||
537 | gl->addWidget( hBox, counter , 1 ); | 538 | gl->addWidget( hBox, counter , 1 ); |
538 | 539 | ||
539 | connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), | 540 | connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), |
540 | this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); | 541 | this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); |
541 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | 542 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); |
542 | 543 | ||
543 | ++counter; | 544 | ++counter; |
544 | 545 | ||
545 | // Anniversary | 546 | // Anniversary |
546 | hBox = new QHBox( container ); | 547 | hBox = new QHBox( container ); |
547 | l = new QLabel( tr("Anniversary"), container ); | 548 | l = new QLabel( tr("Anniversary"), container ); |
548 | gl->addWidget( l, counter, 0 ); | 549 | gl->addWidget( l, counter, 0 ); |
549 | 550 | ||
550 | m1 = new QPopupMenu( container ); | 551 | m1 = new QPopupMenu( container ); |
551 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 552 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); |
552 | m1->insertItem( anniversaryPicker ); | 553 | m1->insertItem( anniversaryPicker ); |
553 | 554 | ||
554 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 555 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
555 | anniversaryButton->setPopup( m1 ); | 556 | anniversaryButton->setPopup( m1 ); |
556 | anniversaryButton->setPopupDelay(0); | 557 | anniversaryButton->setPopupDelay(0); |
557 | 558 | ||
558 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 559 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
559 | tr( "Delete" ), | 560 | tr( "Delete" ), |
560 | hBox, 0 ); | 561 | hBox, 0 ); |
561 | gl->addWidget( hBox, counter , 1 ); | 562 | gl->addWidget( hBox, counter , 1 ); |
562 | 563 | ||
563 | connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), | 564 | connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), |
564 | this, SLOT( slotAnniversaryDateChanged(int,int,int) ) ); | 565 | this, SLOT( slotAnniversaryDateChanged(int,int,int) ) ); |
565 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); | 566 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); |
566 | 567 | ||
567 | ++counter; | 568 | ++counter; |
568 | 569 | ||
569 | // Gender | 570 | // Gender |
570 | l = new QLabel( tr("Gender"), container ); | 571 | l = new QLabel( tr("Gender"), container ); |
571 | gl->addWidget( l, counter, 0 ); | 572 | gl->addWidget( l, counter, 0 ); |
572 | cmbGender = new QComboBox( container ); | 573 | cmbGender = new QComboBox( container ); |
573 | cmbGender->insertItem( "", 0 ); | 574 | cmbGender->insertItem( "", 0 ); |
574 | cmbGender->insertItem( tr("Male"), 1); | 575 | cmbGender->insertItem( tr("Male"), 1); |
575 | cmbGender->insertItem( tr("Female"), 2); | 576 | cmbGender->insertItem( tr("Female"), 2); |
576 | gl->addWidget( cmbGender, counter, 1 ); | 577 | gl->addWidget( cmbGender, counter, 1 ); |
577 | 578 | ||
578 | ++counter; | 579 | ++counter; |
579 | 580 | ||
580 | // Create Labels and lineedit fields for every dynamic entry | 581 | // Create Labels and lineedit fields for every dynamic entry |
581 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 582 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
582 | QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId(); | 583 | QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId(); |
583 | QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields(); | 584 | QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields(); |
584 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { | 585 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { |
585 | 586 | ||
586 | if (((*it) == "Anniversary") || | 587 | if (((*it) == "Anniversary") || |
587 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | 588 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; |
588 | 589 | ||
589 | l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); | 590 | l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); |
590 | listName.append( l ); | 591 | listName.append( l ); |
591 | gl->addWidget( l, i, 0 ); | 592 | gl->addWidget( l, i, 0 ); |
592 | QLineEdit *e = new QLineEdit( container ); | 593 | QLineEdit *e = new QLineEdit( container ); |
593 | listValue.append( e ); | 594 | listValue.append( e ); |
594 | gl->addWidget( e, i, 1); | 595 | gl->addWidget( e, i, 1); |
595 | } | 596 | } |
596 | // Fill labels with names.. | 597 | // Fill labels with names.. |
597 | //loadFields(); | 598 | //loadFields(); |
598 | 599 | ||
599 | 600 | ||
600 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 601 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
601 | 602 | ||
602 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 603 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
603 | dlgNote->setCaption( tr("Enter Note") ); | 604 | dlgNote->setCaption( tr("Enter Note") ); |
604 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 605 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
605 | txtNote = new QMultiLineEdit( dlgNote ); | 606 | txtNote = new QMultiLineEdit( dlgNote ); |
606 | vbNote->addWidget( txtNote ); | 607 | vbNote->addWidget( txtNote ); |
607 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 608 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
608 | 609 | ||
609 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 610 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
610 | dlgName->setCaption( tr("Edit Name") ); | 611 | dlgName->setCaption( tr("Edit Name") ); |
611 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 612 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
612 | 613 | ||
613 | l = new QLabel( tr("First Name"), dlgName ); | 614 | l = new QLabel( tr("First Name"), dlgName ); |
614 | gl->addWidget( l, 0, 0 ); | 615 | gl->addWidget( l, 0, 0 ); |
615 | txtFirstName = new QLineEdit( dlgName ); | 616 | txtFirstName = new QLineEdit( dlgName ); |
616 | gl->addWidget( txtFirstName, 0, 1 ); | 617 | gl->addWidget( txtFirstName, 0, 1 ); |
617 | 618 | ||
618 | l = new QLabel( tr("Middle Name"), dlgName ); | 619 | l = new QLabel( tr("Middle Name"), dlgName ); |
619 | gl->addWidget( l, 1, 0 ); | 620 | gl->addWidget( l, 1, 0 ); |
620 | txtMiddleName = new QLineEdit( dlgName ); | 621 | txtMiddleName = new QLineEdit( dlgName ); |
621 | gl->addWidget( txtMiddleName, 1, 1 ); | 622 | gl->addWidget( txtMiddleName, 1, 1 ); |
622 | 623 | ||
623 | l = new QLabel( tr("Last Name"), dlgName ); | 624 | l = new QLabel( tr("Last Name"), dlgName ); |
624 | gl->addWidget( l, 2, 0 ); | 625 | gl->addWidget( l, 2, 0 ); |
625 | txtLastName = new QLineEdit( dlgName ); | 626 | txtLastName = new QLineEdit( dlgName ); |
626 | gl->addWidget( txtLastName, 2, 1 ); | 627 | gl->addWidget( txtLastName, 2, 1 ); |
627 | 628 | ||
628 | // l = new QLabel( tr("Suffix"), dlgName ); | 629 | // l = new QLabel( tr("Suffix"), dlgName ); |
629 | // gl->addWidget( l, 3, 0 ); | 630 | // gl->addWidget( l, 3, 0 ); |
630 | // txtSuffix = new QLineEdit( dlgName ); | 631 | // txtSuffix = new QLineEdit( dlgName ); |
631 | // gl->addWidget( txtSuffix, 3, 1 ); | 632 | // gl->addWidget( txtSuffix, 3, 1 ); |
632 | space = new QSpacerItem(1,1, | 633 | space = new QSpacerItem(1,1, |
633 | QSizePolicy::Maximum, | 634 | QSizePolicy::Maximum, |
634 | QSizePolicy::MinimumExpanding ); | 635 | QSizePolicy::MinimumExpanding ); |
635 | gl->addItem( space, 4, 0 ); | 636 | gl->addItem( space, 4, 0 ); |
636 | 637 | ||
637 | cmbChooserField1->insertStringList( trlChooserNames ); | 638 | cmbChooserField1->insertStringList( trlChooserNames ); |
638 | cmbChooserField2->insertStringList( trlChooserNames ); | 639 | cmbChooserField2->insertStringList( trlChooserNames ); |
639 | cmbChooserField3->insertStringList( trlChooserNames ); | 640 | cmbChooserField3->insertStringList( trlChooserNames ); |
640 | cmbChooserField4->insertStringList( trlChooserNames ); | 641 | cmbChooserField4->insertStringList( trlChooserNames ); |
641 | 642 | ||
642 | cmbChooserField1->setCurrentItem( 0 ); | 643 | cmbChooserField1->setCurrentItem( 0 ); |
643 | cmbChooserField2->setCurrentItem( 1 ); | 644 | cmbChooserField2->setCurrentItem( 1 ); |
644 | cmbChooserField3->setCurrentItem( 2 ); | 645 | cmbChooserField3->setCurrentItem( 2 ); |
645 | 646 | ||
646 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 647 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
647 | 648 | ||
648 | connect( txtFullName, SIGNAL(textChanged(const QString&)), | 649 | connect( txtFullName, SIGNAL(textChanged(const QString&)), |
649 | this, SLOT(slotFullNameChange(const QString&)) ); | 650 | this, SLOT(slotFullNameChange(const QString&)) ); |
650 | connect( txtSuffix, SIGNAL(textChanged(const QString&)), | 651 | connect( txtSuffix, SIGNAL(textChanged(const QString&)), |
651 | this, SLOT(slotSuffixChange(const QString&)) ); | 652 | this, SLOT(slotSuffixChange(const QString&)) ); |
652 | connect( txtOrganization, SIGNAL(textChanged(const QString&)), | 653 | connect( txtOrganization, SIGNAL(textChanged(const QString&)), |
653 | this, SLOT(slotOrganizationChange(const QString&)) ); | 654 | this, SLOT(slotOrganizationChange(const QString&)) ); |
654 | connect( txtChooserField1, SIGNAL(textChanged(const QString&)), | 655 | connect( txtChooserField1, SIGNAL(textChanged(const QString&)), |
655 | this, SLOT(slotChooser1Change(const QString&)) ); | 656 | this, SLOT(slotChooser1Change(const QString&)) ); |
656 | connect( txtChooserField2, SIGNAL(textChanged(const QString&)), | 657 | connect( txtChooserField2, SIGNAL(textChanged(const QString&)), |
657 | this, SLOT(slotChooser2Change(const QString&)) ); | 658 | this, SLOT(slotChooser2Change(const QString&)) ); |
658 | connect( txtChooserField3, SIGNAL(textChanged(const QString&)), | 659 | connect( txtChooserField3, SIGNAL(textChanged(const QString&)), |
659 | this, SLOT(slotChooser3Change(const QString&)) ); | 660 | this, SLOT(slotChooser3Change(const QString&)) ); |
660 | connect( txtChooserField4, SIGNAL(textChanged(const QString&)), | 661 | connect( txtChooserField4, SIGNAL(textChanged(const QString&)), |
661 | this, SLOT(slotChooser4Change(const QString&)) ); | 662 | this, SLOT(slotChooser4Change(const QString&)) ); |
662 | connect( txtAddress, SIGNAL(textChanged(const QString&)), | 663 | connect( txtAddress, SIGNAL(textChanged(const QString&)), |
663 | this, SLOT(slotAddressChange(const QString&)) ); | 664 | this, SLOT(slotAddressChange(const QString&)) ); |
664 | connect( txtCity, SIGNAL(textChanged(const QString&)), | 665 | connect( txtCity, SIGNAL(textChanged(const QString&)), |
665 | this, SLOT(slotCityChange(const QString&)) ); | 666 | this, SLOT(slotCityChange(const QString&)) ); |
666 | connect( txtState, SIGNAL(textChanged(const QString&)), | 667 | connect( txtState, SIGNAL(textChanged(const QString&)), |
667 | this, SLOT(slotStateChange(const QString&)) ); | 668 | this, SLOT(slotStateChange(const QString&)) ); |
668 | connect( txtZip, SIGNAL(textChanged(const QString&)), | 669 | connect( txtZip, SIGNAL(textChanged(const QString&)), |
669 | this, SLOT(slotZipChange(const QString&)) ); | 670 | this, SLOT(slotZipChange(const QString&)) ); |
670 | connect( cmbCountry, SIGNAL(textChanged(const QString&)), | 671 | connect( cmbCountry, SIGNAL(textChanged(const QString&)), |
671 | this, SLOT(slotCountryChange(const QString&)) ); | 672 | this, SLOT(slotCountryChange(const QString&)) ); |
672 | connect( cmbCountry, SIGNAL(activated(const QString&)), | 673 | connect( cmbCountry, SIGNAL(activated(const QString&)), |
673 | this, SLOT(slotCountryChange(const QString&)) ); | 674 | this, SLOT(slotCountryChange(const QString&)) ); |
674 | connect( cmbChooserField1, SIGNAL(activated(int)), | 675 | connect( cmbChooserField1, SIGNAL(activated(int)), |
675 | this, SLOT(slotCmbChooser1Change(int)) ); | 676 | this, SLOT(slotCmbChooser1Change(int)) ); |
676 | connect( cmbChooserField2, SIGNAL(activated(int)), | 677 | connect( cmbChooserField2, SIGNAL(activated(int)), |
677 | this, SLOT(slotCmbChooser2Change(int)) ); | 678 | this, SLOT(slotCmbChooser2Change(int)) ); |
678 | connect( cmbChooserField3, SIGNAL(activated(int)), | 679 | connect( cmbChooserField3, SIGNAL(activated(int)), |
679 | this, SLOT(slotCmbChooser3Change(int)) ); | 680 | this, SLOT(slotCmbChooser3Change(int)) ); |
680 | connect( cmbChooserField4, SIGNAL(activated(int)), | 681 | connect( cmbChooserField4, SIGNAL(activated(int)), |
681 | this, SLOT(slotCmbChooser4Change(int)) ); | 682 | this, SLOT(slotCmbChooser4Change(int)) ); |
682 | connect( cmbAddress, SIGNAL(activated(int)), | 683 | connect( cmbAddress, SIGNAL(activated(int)), |
683 | this, SLOT(slotAddressTypeChange(int)) ); | 684 | this, SLOT(slotAddressTypeChange(int)) ); |
684 | 685 | ||
685 | new QPEDialogListener(this); | 686 | new QPEDialogListener(this); |
686 | 687 | ||
687 | setPersonalView ( m_personalView ); | 688 | setPersonalView ( m_personalView ); |
688 | 689 | ||
689 | qWarning("init() END"); | 690 | Opie::Core::owarn << "init() END" << oendl; |
690 | } | 691 | } |
691 | 692 | ||
692 | void ContactEditor::defaultEmailChanged(int i){ | 693 | void ContactEditor::defaultEmailChanged(int i){ |
693 | qDebug("defaultEmailChanged"); | 694 | Opie::Core::odebug << "defaultEmailChanged" << oendl; |
694 | 695 | ||
695 | // was sollte das ? (se) | 696 | // was sollte das ? (se) |
696 | // int index = cmbChooserField1->currentItem(); | 697 | // int index = cmbChooserField1->currentItem(); |
697 | // slChooserValues[index] = cmbDefaultEmail->text(i); | 698 | // slChooserValues[index] = cmbDefaultEmail->text(i); |
698 | 699 | ||
699 | defaultEmail = cmbDefaultEmail->text(i); | 700 | defaultEmail = cmbDefaultEmail->text(i); |
700 | qDebug ("Changed to: %s", defaultEmail.latin1()); | 701 | Opie::Core::odebug << "Changed to: " << defaultEmail << oendl; |
701 | 702 | ||
702 | } | 703 | } |
703 | 704 | ||
704 | void ContactEditor::populateDefaultEmailCmb(){ | 705 | void ContactEditor::populateDefaultEmailCmb(){ |
705 | 706 | ||
706 | // if the default-email combo was not selected and therfore not created | 707 | // if the default-email combo was not selected and therfore not created |
707 | // we get a lot of trouble.. Therfore create an invisible one.. | 708 | // we get a lot of trouble.. Therfore create an invisible one.. |
708 | if ( !cmbDefaultEmail ){ | 709 | if ( !cmbDefaultEmail ){ |
709 | cmbDefaultEmail = new QComboBox(this); | 710 | cmbDefaultEmail = new QComboBox(this); |
710 | cmbDefaultEmail -> hide(); | 711 | cmbDefaultEmail -> hide(); |
711 | } | 712 | } |
712 | cmbDefaultEmail->clear(); | 713 | cmbDefaultEmail->clear(); |
713 | cmbDefaultEmail->insertStringList( emails ); | 714 | cmbDefaultEmail->insertStringList( emails ); |
714 | // cmbDefaultEmail->show(); | 715 | // cmbDefaultEmail->show(); |
715 | 716 | ||
716 | // Select default email in combo.. | 717 | // Select default email in combo.. |
717 | bool found = false; | 718 | bool found = false; |
718 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 719 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
719 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", | 720 | Opie::Core::odebug << " populateDefaultEmailCmb text >" << cmbDefaultEmail->text( i ) |
720 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); | 721 | << "< defaultEmail >" << defaultEmail << "<" << oendl; |
721 | 722 | ||
722 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 723 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
723 | cmbDefaultEmail->setCurrentItem( i ); | 724 | cmbDefaultEmail->setCurrentItem( i ); |
724 | qDebug("set"); | 725 | Opie::Core::odebug << "set" << oendl; |
725 | found = true; | 726 | found = true; |
726 | } | 727 | } |
727 | } | 728 | } |
728 | 729 | ||
729 | // If the current default email is not found in the list, we choose the | 730 | // If the current default email is not found in the list, we choose the |
730 | // first one.. | 731 | // first one.. |
731 | if ( !found ) | 732 | if ( !found ) |
732 | defaultEmail = cmbDefaultEmail->text(0); | 733 | defaultEmail = cmbDefaultEmail->text(0); |
733 | } | 734 | } |
734 | 735 | ||
735 | // Called when any combobox was changed. | 736 | // Called when any combobox was changed. |
736 | // "true" returned if the change was chandled by this function, else it should | 737 | // "true" returned if the change was chandled by this function, else it should |
737 | // be handled by something else.. | 738 | // be handled by something else.. |
738 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { | 739 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { |
739 | QString type = slChooserNames[index]; | 740 | QString type = slChooserNames[index]; |
740 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); | 741 | Opie::Core::owarn << "ContactEditor::cmbChooserChange -> Type: " << type |
742 | << ", WidgetPos: " << widgetPos << oendl; | ||
741 | 743 | ||
742 | if ( !initializing ) | 744 | if ( !initializing ) |
743 | contactfields.setFieldOrder( widgetPos-1, index ); | 745 | contactfields.setFieldOrder( widgetPos-1, index ); |
744 | 746 | ||
745 | // Create and connect combobox for selecting the default email | 747 | // Create and connect combobox for selecting the default email |
746 | if ( type == "Default Email"){ | 748 | if ( type == "Default Email"){ |
747 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); | 749 | Opie::Core::owarn << "Choosing default-email (defaultEmailChooserPosition= " |
750 | << defaultEmailChooserPosition << ") " << oendl; | ||
748 | 751 | ||
749 | // More than one default-email chooser is not allowed ! | 752 | // More than one default-email chooser is not allowed ! |
750 | if ( ( defaultEmailChooserPosition != -1 ) && | 753 | if ( ( defaultEmailChooserPosition != -1 ) && |
751 | defaultEmailChooserPosition != widgetPos && !initializing){ | 754 | defaultEmailChooserPosition != widgetPos && !initializing){ |
752 | chooserError( widgetPos ); | 755 | chooserError( widgetPos ); |
753 | return true; | 756 | return true; |
754 | } | 757 | } |
755 | 758 | ||
756 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 759 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
757 | if ( cmbo ){ | 760 | if ( cmbo ){ |
758 | inputStack->raiseWidget( TextField ); | 761 | inputStack->raiseWidget( TextField ); |
759 | inputStack -> removeWidget( cmbo ); | 762 | inputStack -> removeWidget( cmbo ); |
760 | delete cmbo; | 763 | delete cmbo; |
761 | } | 764 | } |
762 | cmbo = new QComboBox( inputStack ); | 765 | cmbo = new QComboBox( inputStack ); |
763 | cmbo -> insertStringList( emails ); | 766 | cmbo -> insertStringList( emails ); |
764 | 767 | ||
765 | inputStack -> addWidget( cmbo, Combo ); | 768 | inputStack -> addWidget( cmbo, Combo ); |
766 | inputStack -> raiseWidget( Combo ); | 769 | inputStack -> raiseWidget( Combo ); |
767 | 770 | ||
768 | defaultEmailChooserPosition = widgetPos; | 771 | defaultEmailChooserPosition = widgetPos; |
769 | cmbDefaultEmail = cmbo; | 772 | cmbDefaultEmail = cmbo; |
770 | 773 | ||
771 | connect( cmbo,SIGNAL( activated(int) ), | 774 | connect( cmbo,SIGNAL( activated(int) ), |
772 | SLOT( defaultEmailChanged(int) ) ); | 775 | SLOT( defaultEmailChanged(int) ) ); |
773 | 776 | ||
774 | // Set current default email | 777 | // Set current default email |
775 | populateDefaultEmailCmb(); | 778 | populateDefaultEmailCmb(); |
776 | 779 | ||
777 | 780 | ||
778 | } else { | 781 | } else { |
779 | // Something else was selected: Hide combo.. | 782 | // Something else was selected: Hide combo.. |
780 | qWarning(" Hiding default-email combo" ); | 783 | Opie::Core::owarn << " Hiding default-email combo" << oendl; |
781 | if ( defaultEmailChooserPosition == widgetPos ){ | 784 | if ( defaultEmailChooserPosition == widgetPos ){ |
782 | defaultEmailChooserPosition = -1; | 785 | defaultEmailChooserPosition = -1; |
783 | } | 786 | } |
784 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 787 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
785 | if ( cmbo ){ | 788 | if ( cmbo ){ |
786 | inputStack->raiseWidget( TextField ); | 789 | inputStack->raiseWidget( TextField ); |
787 | inputStack -> removeWidget( cmbo ); | 790 | inputStack -> removeWidget( cmbo ); |
788 | cmbDefaultEmail = 0l; | 791 | cmbDefaultEmail = 0l; |
789 | delete cmbo; | 792 | delete cmbo; |
790 | } | 793 | } |
791 | 794 | ||
792 | // Caller should initialize the responsible textfield, therefore | 795 | // Caller should initialize the responsible textfield, therefore |
793 | // "false" is returned | 796 | // "false" is returned |
794 | return false; | 797 | return false; |
795 | } | 798 | } |
796 | 799 | ||
797 | // Everything is worked off .. | 800 | // Everything is worked off .. |
798 | return true; | 801 | return true; |
799 | 802 | ||
800 | } | 803 | } |
801 | 804 | ||
802 | // Currently accessed when we select default-email more than once ! | 805 | // Currently accessed when we select default-email more than once ! |
803 | void ContactEditor::chooserError( int index ) | 806 | void ContactEditor::chooserError( int index ) |
804 | { | 807 | { |
805 | qWarning("ContactEditor::chooserError( %d )", index); | 808 | Opie::Core::owarn << "ContactEditor::chooserError( " << index << " )" << oendl; |
806 | QMessageBox::warning( this, "Chooser Error", | 809 | QMessageBox::warning( this, "Chooser Error", |
807 | "Multiple selection of this\n" | 810 | "Multiple selection of this\n" |
808 | "Item is not allowed !\n\n" | 811 | "Item is not allowed !\n\n" |
809 | "First deselect the previous one !", | 812 | "First deselect the previous one !", |
810 | "&OK", 0, 0, | 813 | "&OK", 0, 0, |
811 | 0, 0 ); | 814 | 0, 0 ); |
812 | 815 | ||
813 | // Reset the selected Chooser. Unfortunately the chooser | 816 | // Reset the selected Chooser. Unfortunately the chooser |
814 | // generates no signal, therfore we have to | 817 | // generates no signal, therfore we have to |
815 | // call the cmbChooserChange function manually.. | 818 | // call the cmbChooserChange function manually.. |
816 | switch( index ){ | 819 | switch( index ){ |
817 | case 1: | 820 | case 1: |
818 | cmbChooserField1 -> setCurrentItem( 0 ); | 821 | cmbChooserField1 -> setCurrentItem( 0 ); |
819 | slotCmbChooser1Change( 0 ); | 822 | slotCmbChooser1Change( 0 ); |
820 | break; | 823 | break; |
821 | case 2: | 824 | case 2: |
822 | cmbChooserField2 -> setCurrentItem( 0 ); | 825 | cmbChooserField2 -> setCurrentItem( 0 ); |
823 | slotCmbChooser2Change( 0 ); | 826 | slotCmbChooser2Change( 0 ); |
824 | break; | 827 | break; |
825 | case 3: | 828 | case 3: |
826 | cmbChooserField3 -> setCurrentItem( 0 ); | 829 | cmbChooserField3 -> setCurrentItem( 0 ); |
827 | slotCmbChooser3Change( 0 ); | 830 | slotCmbChooser3Change( 0 ); |
828 | break; | 831 | break; |
829 | case 4: | 832 | case 4: |
830 | cmbChooserField4 -> setCurrentItem( 0 ); | 833 | cmbChooserField4 -> setCurrentItem( 0 ); |
831 | slotCmbChooser4Change( 0 ); | 834 | slotCmbChooser4Change( 0 ); |
832 | break; | 835 | break; |
833 | } | 836 | } |
834 | } | 837 | } |
835 | 838 | ||
836 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) | 839 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
837 | void ContactEditor::chooserChange( const QString &textChanged, int index, | 840 | void ContactEditor::chooserChange( const QString &textChanged, int index, |
838 | QLineEdit* , int widgetPos ) { | 841 | QLineEdit* , int widgetPos ) { |
839 | 842 | ||
840 | QString type = slChooserNames[index]; // :SX | 843 | QString type = slChooserNames[index]; // :SX |
841 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", | 844 | Opie::Core::odebug << "ContactEditor::chooserChange( type=>" << type << "<, textChanged=>" |
842 | type.latin1(),textChanged.latin1(), index, widgetPos ); | 845 | << textChanged << "< index=" << index << ", widgetPos=" << widgetPos |
846 | << " )" << oendl; | ||
843 | 847 | ||
844 | if ( type == "Default Email"){ | 848 | if ( type == "Default Email"){ |
845 | qWarning ("??? Wozu??: %s", textChanged.latin1()); | 849 | Opie::Core::owarn << "??? Wozu??: " << textChanged << oendl; |
846 | defaultEmail = textChanged; | 850 | defaultEmail = textChanged; |
847 | 851 | ||
848 | populateDefaultEmailCmb(); | 852 | populateDefaultEmailCmb(); |
849 | 853 | ||
850 | }else if (type == "Emails"){ | 854 | }else if (type == "Emails"){ |
851 | qDebug("emails"); | 855 | Opie::Core::odebug << "emails" << oendl; |
852 | 856 | ||
853 | QString de; | 857 | QString de; |
854 | emails = QStringList::split (",", textChanged ); | 858 | emails = QStringList::split (",", textChanged ); |
855 | 859 | ||
856 | populateDefaultEmailCmb(); | 860 | populateDefaultEmailCmb(); |
857 | } | 861 | } |
858 | 862 | ||
859 | slChooserValues[index] = textChanged; | 863 | slChooserValues[index] = textChanged; |
860 | 864 | ||
861 | } | 865 | } |
862 | 866 | ||
863 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 867 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
864 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); | 868 | Opie::Core::owarn << "ContactEditor::slotChooser1Change( " << textChanged << " )" << oendl; |
865 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 869 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
866 | } | 870 | } |
867 | 871 | ||
868 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 872 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
869 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); | 873 | Opie::Core::owarn << "ContactEditor::slotChooser2Change( " << textChanged << " )" << oendl; |
870 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 874 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
871 | 875 | ||
872 | } | 876 | } |
873 | 877 | ||
874 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 878 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
875 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); | 879 | Opie::Core::owarn << "ContactEditor::slotChooser3Change( " << textChanged << " )" << oendl; |
876 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 880 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
877 | } | 881 | } |
878 | 882 | ||
879 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 883 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
880 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); | 884 | Opie::Core::owarn << "ContactEditor::slotChooser4Change( " << textChanged << " )" << oendl; |
881 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 885 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
882 | } | 886 | } |
883 | 887 | ||
884 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 888 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
885 | 889 | ||
886 | if ( cmbAddress->currentItem() == 0 ) { | 890 | if ( cmbAddress->currentItem() == 0 ) { |
887 | slBusinessAddress[0] = textChanged; | 891 | slBusinessAddress[0] = textChanged; |
888 | } else { | 892 | } else { |
889 | slHomeAddress[0] = textChanged; | 893 | slHomeAddress[0] = textChanged; |
890 | } | 894 | } |
891 | } | 895 | } |
892 | 896 | ||
893 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 897 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
894 | 898 | ||
895 | if ( cmbAddress->currentItem() == 0 ) { | 899 | if ( cmbAddress->currentItem() == 0 ) { |
896 | slBusinessAddress[1] = textChanged; | 900 | slBusinessAddress[1] = textChanged; |
897 | } else { | 901 | } else { |
898 | slHomeAddress[1] = textChanged; | 902 | slHomeAddress[1] = textChanged; |
899 | } | 903 | } |
900 | } | 904 | } |
901 | 905 | ||
902 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 906 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
903 | 907 | ||
904 | if ( cmbAddress->currentItem() == 0 ) { | 908 | if ( cmbAddress->currentItem() == 0 ) { |
905 | slBusinessAddress[2] = textChanged; | 909 | slBusinessAddress[2] = textChanged; |
906 | } else { | 910 | } else { |
907 | slHomeAddress[2] = textChanged; | 911 | slHomeAddress[2] = textChanged; |
908 | } | 912 | } |
909 | } | 913 | } |
910 | 914 | ||
911 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 915 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
912 | 916 | ||
913 | if ( cmbAddress->currentItem() == 0 ) { | 917 | if ( cmbAddress->currentItem() == 0 ) { |
914 | slBusinessAddress[3] = textChanged; | 918 | slBusinessAddress[3] = textChanged; |
915 | } else { | 919 | } else { |
916 | slHomeAddress[3] = textChanged; | 920 | slHomeAddress[3] = textChanged; |
917 | } | 921 | } |
918 | } | 922 | } |
919 | 923 | ||
920 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 924 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
921 | 925 | ||
922 | 926 | ||
923 | if ( cmbAddress->currentItem() == 0 ) { | 927 | if ( cmbAddress->currentItem() == 0 ) { |
924 | slBusinessAddress[4] = textChanged; | 928 | slBusinessAddress[4] = textChanged; |
925 | } else { | 929 | } else { |
926 | slHomeAddress[4] = textChanged; | 930 | slHomeAddress[4] = textChanged; |
927 | } | 931 | } |
928 | } | 932 | } |
929 | 933 | ||
930 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 934 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
931 | 935 | ||
932 | if ( cmbAddress->currentItem() == 0 ) { | 936 | if ( cmbAddress->currentItem() == 0 ) { |
933 | slBusinessAddress[5] = textChanged; | 937 | slBusinessAddress[5] = textChanged; |
934 | } else { | 938 | } else { |
935 | slHomeAddress[5] = textChanged; | 939 | slHomeAddress[5] = textChanged; |
936 | } | 940 | } |
937 | } | 941 | } |
938 | 942 | ||
939 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 943 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
940 | 944 | ||
941 | if ( cmbAddress->currentItem() == 0 ) { | 945 | if ( cmbAddress->currentItem() == 0 ) { |
942 | slBusinessAddress[6] = textChanged; | 946 | slBusinessAddress[6] = textChanged; |
943 | } else { | 947 | } else { |
944 | slHomeAddress[6] = textChanged; | 948 | slHomeAddress[6] = textChanged; |
945 | } | 949 | } |
946 | } | 950 | } |
947 | 951 | ||
948 | 952 | ||
949 | void ContactEditor::slotCmbChooser1Change( int index ) { | 953 | void ContactEditor::slotCmbChooser1Change( int index ) { |
950 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); | 954 | Opie::Core::owarn << "ContactEditor::slotCmbChooser1Change( " << index << " )" << oendl; |
951 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ | 955 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ |
952 | 956 | ||
953 | txtChooserField1->setText( slChooserValues[index] ); | 957 | txtChooserField1->setText( slChooserValues[index] ); |
954 | txtChooserField1->setFocus(); | 958 | txtChooserField1->setFocus(); |
955 | 959 | ||
956 | } | 960 | } |
957 | 961 | ||
958 | } | 962 | } |
959 | 963 | ||
960 | void ContactEditor::slotCmbChooser2Change( int index ) { | 964 | void ContactEditor::slotCmbChooser2Change( int index ) { |
961 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); | 965 | Opie::Core::owarn << "ContactEditor::slotCmbChooser2Change( " << index << " )" << oendl; |
962 | 966 | ||
963 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ | 967 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ |
964 | 968 | ||
965 | txtChooserField2->setText( slChooserValues[index] ); | 969 | txtChooserField2->setText( slChooserValues[index] ); |
966 | txtChooserField2->setFocus(); | 970 | txtChooserField2->setFocus(); |
967 | 971 | ||
968 | } | 972 | } |
969 | } | 973 | } |
970 | 974 | ||
971 | void ContactEditor::slotCmbChooser3Change( int index ) { | 975 | void ContactEditor::slotCmbChooser3Change( int index ) { |
972 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); | 976 | Opie::Core::owarn << "ContactEditor::slotCmbChooser3Change( " << index << " )" << oendl; |
973 | 977 | ||
974 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ | 978 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ |
975 | 979 | ||
976 | txtChooserField3->setText( slChooserValues[index] ); | 980 | txtChooserField3->setText( slChooserValues[index] ); |
977 | txtChooserField3->setFocus(); | 981 | txtChooserField3->setFocus(); |
978 | 982 | ||
979 | } | 983 | } |
980 | } | 984 | } |
981 | 985 | ||
982 | void ContactEditor::slotCmbChooser4Change( int index ) { | 986 | void ContactEditor::slotCmbChooser4Change( int index ) { |
983 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); | 987 | Opie::Core::owarn << "ContactEditor::slotCmbChooser4Change( " << index << " )" << oendl; |
984 | 988 | ||
985 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ | 989 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ |
986 | 990 | ||
987 | txtChooserField4->setText( slChooserValues[index] ); | 991 | txtChooserField4->setText( slChooserValues[index] ); |
988 | txtChooserField4->setFocus(); | 992 | txtChooserField4->setFocus(); |
989 | 993 | ||
990 | } | 994 | } |
991 | } | 995 | } |
992 | 996 | ||
993 | void ContactEditor::slotAddressTypeChange( int index ) { | 997 | void ContactEditor::slotAddressTypeChange( int index ) { |
994 | 998 | ||
995 | 999 | ||
996 | if ( !initializing ) | 1000 | if ( !initializing ) |
997 | contactfields.setFieldOrder( 4, index ); | 1001 | contactfields.setFieldOrder( 4, index ); |
998 | 1002 | ||
999 | 1003 | ||
1000 | if ( index == 0 ) { | 1004 | if ( index == 0 ) { |
1001 | 1005 | ||
1002 | txtAddress->setText( slBusinessAddress[0] ); | 1006 | txtAddress->setText( slBusinessAddress[0] ); |
1003 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 1007 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
1004 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 1008 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
1005 | txtCity->setText( slBusinessAddress[3] ); | 1009 | txtCity->setText( slBusinessAddress[3] ); |
1006 | txtState->setText( slBusinessAddress[4] ); | 1010 | txtState->setText( slBusinessAddress[4] ); |
1007 | txtZip->setText( slBusinessAddress[5] ); | 1011 | txtZip->setText( slBusinessAddress[5] ); |
1008 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1012 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1009 | txtTmp->setText( slBusinessAddress[6] ); | 1013 | txtTmp->setText( slBusinessAddress[6] ); |
1010 | 1014 | ||
1011 | } else { | 1015 | } else { |
1012 | 1016 | ||
1013 | txtAddress->setText( slHomeAddress[0] ); | 1017 | txtAddress->setText( slHomeAddress[0] ); |
1014 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 1018 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
1015 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 1019 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
1016 | txtCity->setText( slHomeAddress[3] ); | 1020 | txtCity->setText( slHomeAddress[3] ); |
1017 | txtState->setText( slHomeAddress[4] ); | 1021 | txtState->setText( slHomeAddress[4] ); |
1018 | txtZip->setText( slHomeAddress[5] ); | 1022 | txtZip->setText( slHomeAddress[5] ); |
1019 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1023 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1020 | txtTmp->setText( slHomeAddress[6] ); | 1024 | txtTmp->setText( slHomeAddress[6] ); |
1021 | 1025 | ||
1022 | } | 1026 | } |
1023 | 1027 | ||
1024 | } | 1028 | } |
1025 | 1029 | ||
1026 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1030 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
1027 | 1031 | ||
1028 | qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); | 1032 | Opie::Core::owarn << "ContactEditor::slotFullNameChange( " << textChanged << " )" << oendl; |
1029 | 1033 | ||
1030 | int index = cmbFileAs->currentItem(); | 1034 | int index = cmbFileAs->currentItem(); |
1031 | 1035 | ||
1032 | cmbFileAs->clear(); | 1036 | cmbFileAs->clear(); |
1033 | 1037 | ||
1034 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); | 1038 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); |
1035 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); | 1039 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); |
1036 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); | 1040 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); |
1037 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); | 1041 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); |
1038 | if ( ! txtSuffix->text().isEmpty() ) | 1042 | if ( ! txtSuffix->text().isEmpty() ) |
1039 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); | 1043 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); |
1040 | 1044 | ||
1041 | cmbFileAs->setCurrentItem( index ); | 1045 | cmbFileAs->setCurrentItem( index ); |
1042 | 1046 | ||
1043 | 1047 | ||
1044 | } | 1048 | } |
1045 | 1049 | ||
1046 | void ContactEditor::slotSuffixChange( const QString& ) { | 1050 | void ContactEditor::slotSuffixChange( const QString& ) { |
1047 | // Just want to update the FileAs combo if the suffix was changed.. | 1051 | // Just want to update the FileAs combo if the suffix was changed.. |
1048 | slotFullNameChange( txtFullName->text() ); | 1052 | slotFullNameChange( txtFullName->text() ); |
1049 | } | 1053 | } |
1050 | 1054 | ||
1051 | void ContactEditor::slotOrganizationChange( const QString &textChanged ){ | 1055 | void ContactEditor::slotOrganizationChange( const QString &textChanged ){ |
1052 | qWarning( "ContactEditor::slotOrganizationChange( %s )", textChanged.latin1() ); | 1056 | Opie::Core::owarn << "ContactEditor::slotOrganizationChange( " << textChanged << " )" << oendl; |
1053 | // Special handling for storing Companies: | 1057 | // Special handling for storing Companies: |
1054 | // If no Fullname is given, we store the Company-Name as lastname | 1058 | // If no Fullname is given, we store the Company-Name as lastname |
1055 | // to handle it like a person.. | 1059 | // to handle it like a person.. |
1056 | if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) | 1060 | if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) |
1057 | txtFullName->setText( textChanged ); | 1061 | txtFullName->setText( textChanged ); |
1058 | 1062 | ||
1059 | } | 1063 | } |
1060 | 1064 | ||
1061 | void ContactEditor::accept() { | 1065 | void ContactEditor::accept() { |
1062 | 1066 | ||
1063 | if ( isEmpty() ) { | 1067 | if ( isEmpty() ) { |
1064 | cleanupFields(); | 1068 | cleanupFields(); |
1065 | reject(); | 1069 | reject(); |
1066 | } else { | 1070 | } else { |
1067 | saveEntry(); | 1071 | saveEntry(); |
1068 | cleanupFields(); | 1072 | cleanupFields(); |
1069 | QDialog::accept(); | 1073 | QDialog::accept(); |
1070 | } | 1074 | } |
1071 | 1075 | ||
1072 | } | 1076 | } |
1073 | 1077 | ||
1074 | void ContactEditor::slotNote() { | 1078 | void ContactEditor::slotNote() { |
1075 | 1079 | ||
1076 | if ( ! QPEApplication::execDialog( dlgNote ) ) { | 1080 | if ( ! QPEApplication::execDialog( dlgNote ) ) { |
1077 | txtNote->setText( ent.notes() ); | 1081 | txtNote->setText( ent.notes() ); |
1078 | } | 1082 | } |
1079 | } | 1083 | } |
1080 | 1084 | ||
1081 | void ContactEditor::slotName() { | 1085 | void ContactEditor::slotName() { |
1082 | 1086 | ||
1083 | QString tmpName; | 1087 | QString tmpName; |
1084 | 1088 | ||
1085 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1089 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1086 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1090 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1087 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1091 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1088 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1092 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1089 | 1093 | ||
1090 | if ( QPEApplication::execDialog( dlgName ) ) { | 1094 | if ( QPEApplication::execDialog( dlgName ) ) { |
1091 | if ( txtLastName->text().contains( ' ', TRUE ) ) | 1095 | if ( txtLastName->text().contains( ' ', TRUE ) ) |
1092 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); | 1096 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); |
1093 | else | 1097 | else |
1094 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); | 1098 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); |
1095 | 1099 | ||
1096 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1100 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1097 | slotFullNameChange( txtFullName->text() ); | 1101 | slotFullNameChange( txtFullName->text() ); |
1098 | } | 1102 | } |
1099 | 1103 | ||
1100 | } | 1104 | } |
1101 | 1105 | ||
1102 | void ContactEditor::setNameFocus() { | 1106 | void ContactEditor::setNameFocus() { |
1103 | 1107 | ||
1104 | txtFullName->setFocus(); | 1108 | txtFullName->setFocus(); |
1105 | 1109 | ||
1106 | } | 1110 | } |
1107 | 1111 | ||
1108 | bool ContactEditor::isEmpty() { | 1112 | bool ContactEditor::isEmpty() { |
1109 | // Test and see if the record should be saved. | 1113 | // Test and see if the record should be saved. |
1110 | // More strict than the original qtopia, needs name or fileas to save | 1114 | // More strict than the original qtopia, needs name or fileas to save |
1111 | 1115 | ||
1112 | QString t = txtFullName->text(); | 1116 | QString t = txtFullName->text(); |
1113 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1117 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1114 | return false; | 1118 | return false; |
1115 | 1119 | ||
1116 | t = cmbFileAs->currentText(); | 1120 | t = cmbFileAs->currentText(); |
1117 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1121 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1118 | return false; | 1122 | return false; |
1119 | 1123 | ||
1120 | return true; | 1124 | return true; |
1121 | 1125 | ||
1122 | } | 1126 | } |
1123 | 1127 | ||
1124 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1128 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1125 | 1129 | ||
1126 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1130 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1127 | QString strFirstName; | 1131 | QString strFirstName; |
1128 | QString strMiddleName; | 1132 | QString strMiddleName; |
1129 | QString strLastName; | 1133 | QString strLastName; |
1130 | QString strTitle; | 1134 | QString strTitle; |
1131 | int commapos; | 1135 | int commapos; |
1132 | bool haveLastName = false; | 1136 | bool haveLastName = false; |
1133 | 1137 | ||
1134 | qWarning("Fullname: %s", simplifiedName.latin1()); | 1138 | Opie::Core::owarn << "Fullname: " << simplifiedName << oendl; |
1135 | 1139 | ||
1136 | commapos = simplifiedName.find( ',', 0, TRUE); | 1140 | commapos = simplifiedName.find( ',', 0, TRUE); |
1137 | if ( commapos >= 0 ) { | 1141 | if ( commapos >= 0 ) { |
1138 | qWarning(" Commapos: %d", commapos ); | 1142 | Opie::Core::owarn << " Commapos: " << commapos << oendl; |
1139 | 1143 | ||
1140 | // A comma (",") separates the lastname from one or | 1144 | // A comma (",") separates the lastname from one or |
1141 | // many first names. Thus, remove the lastname from the | 1145 | // many first names. Thus, remove the lastname from the |
1142 | // String and parse the firstnames. | 1146 | // String and parse the firstnames. |
1143 | 1147 | ||
1144 | strLastName = simplifiedName.left( commapos ); | 1148 | strLastName = simplifiedName.left( commapos ); |
1145 | simplifiedName= simplifiedName.mid( commapos + 1 ); | 1149 | simplifiedName= simplifiedName.mid( commapos + 1 ); |
1146 | haveLastName = true; | 1150 | haveLastName = true; |
1147 | qWarning("Fullname without ',': %s", simplifiedName.latin1()); | 1151 | Opie::Core::owarn << "Fullname without ',': " << simplifiedName << oendl; |
1148 | 1152 | ||
1149 | // If we have any lastname, we should now split all first names. | 1153 | // If we have any lastname, we should now split all first names. |
1150 | // The first one will be the used as first, the rest as "middle names" | 1154 | // The first one will be the used as first, the rest as "middle names" |
1151 | 1155 | ||
1152 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); | 1156 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); |
1153 | QStringList::Iterator it = allFirstNames.begin(); | 1157 | QStringList::Iterator it = allFirstNames.begin(); |
1154 | strFirstName = *it++; | 1158 | strFirstName = *it++; |
1155 | QStringList allSecondNames; | 1159 | QStringList allSecondNames; |
1156 | for ( ; it != allFirstNames.end(); ++it ) | 1160 | for ( ; it != allFirstNames.end(); ++it ) |
1157 | allSecondNames.append( *it ); | 1161 | allSecondNames.append( *it ); |
1158 | 1162 | ||
1159 | strMiddleName = allSecondNames.join(" "); | 1163 | strMiddleName = allSecondNames.join(" "); |
1160 | 1164 | ||
1161 | } else { | 1165 | } else { |
1162 | 1166 | ||
1163 | // No comma separator used: We use the first word as firstname, the | 1167 | // No comma separator used: We use the first word as firstname, the |
1164 | // last as second/lastname and everything in the middle as middlename | 1168 | // last as second/lastname and everything in the middle as middlename |
1165 | 1169 | ||
1166 | QStringList allNames = QStringList::split(" ", simplifiedName); | 1170 | QStringList allNames = QStringList::split(" ", simplifiedName); |
1167 | QStringList::Iterator it = allNames.begin(); | 1171 | QStringList::Iterator it = allNames.begin(); |
1168 | strFirstName = *it++; | 1172 | strFirstName = *it++; |
1169 | QStringList allSecondNames; | 1173 | QStringList allSecondNames; |
1170 | for ( ; it != --allNames.end(); ++it ) | 1174 | for ( ; it != --allNames.end(); ++it ) |
1171 | allSecondNames.append( *it ); | 1175 | allSecondNames.append( *it ); |
1172 | 1176 | ||
1173 | strMiddleName = allSecondNames.join(" "); | 1177 | strMiddleName = allSecondNames.join(" "); |
1174 | strLastName = *(--allNames.end()); | 1178 | strLastName = *(--allNames.end()); |
1175 | 1179 | ||
1176 | } | 1180 | } |
1177 | 1181 | ||
1178 | if ( strFirstName == strLastName ) | 1182 | if ( strFirstName == strLastName ) |
1179 | strFirstName = ""; | 1183 | strFirstName = ""; |
1180 | 1184 | ||
1181 | qWarning(" strFirstName: %s", strFirstName.latin1()); | 1185 | Opie::Core::owarn << "strFirstName: " << strFirstName << oendl; |
1182 | qWarning(" strMiddleName: %s", strMiddleName.latin1()); | 1186 | Opie::Core::owarn << "strMiddletName: " << strMiddleName << oendl; |
1183 | qWarning(" strLastName: %s", strLastName.latin1()); | 1187 | Opie::Core::owarn << "strLastName: " << strLastName << oendl; |
1184 | qWarning(" strTitle: %s", strTitle.latin1()); | 1188 | Opie::Core::owarn << "strTitle: " << strTitle << oendl; |
1185 | 1189 | ||
1186 | switch (type) { | 1190 | switch (type) { |
1187 | case NAME_FL: | 1191 | case NAME_FL: |
1188 | return strFirstName + " " + strLastName; | 1192 | return strFirstName + " " + strLastName; |
1189 | 1193 | ||
1190 | case NAME_LF: | 1194 | case NAME_LF: |
1191 | return strLastName + ", " + strFirstName; | 1195 | return strLastName + ", " + strFirstName; |
1192 | 1196 | ||
1193 | case NAME_LFM: | 1197 | case NAME_LFM: |
1194 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1198 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1195 | 1199 | ||
1196 | case NAME_FML: | 1200 | case NAME_FML: |
1197 | return strFirstName + " " + strMiddleName + " " + strLastName ; | 1201 | return strFirstName + " " + strMiddleName + " " + strLastName ; |
1198 | 1202 | ||
1199 | case NAME_F: | 1203 | case NAME_F: |
1200 | return strFirstName; | 1204 | return strFirstName; |
1201 | 1205 | ||
1202 | case NAME_M: | 1206 | case NAME_M: |
1203 | return strMiddleName; | 1207 | return strMiddleName; |
1204 | 1208 | ||
1205 | case NAME_L: | 1209 | case NAME_L: |
1206 | return strLastName; | 1210 | return strLastName; |
1207 | 1211 | ||
1208 | case NAME_S: | 1212 | case NAME_S: |
1209 | return txtSuffix->text(); | 1213 | return txtSuffix->text(); |
1210 | 1214 | ||
1211 | } | 1215 | } |
1212 | return QString::null; | 1216 | return QString::null; |
1213 | } | 1217 | } |
1214 | 1218 | ||
1215 | void ContactEditor::cleanupFields() { | 1219 | void ContactEditor::cleanupFields() { |
1216 | QStringList::Iterator it = slChooserValues.begin(); | 1220 | QStringList::Iterator it = slChooserValues.begin(); |
1217 | 1221 | ||
1218 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1222 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1219 | (*it) = ""; | 1223 | (*it) = ""; |
1220 | } | 1224 | } |
1221 | 1225 | ||
1222 | for ( int i = 0; i < 7; i++ ) { | 1226 | for ( int i = 0; i < 7; i++ ) { |
1223 | slHomeAddress[i] = ""; | 1227 | slHomeAddress[i] = ""; |
1224 | slBusinessAddress[i] = ""; | 1228 | slBusinessAddress[i] = ""; |
1225 | } | 1229 | } |
1226 | 1230 | ||
1227 | QListIterator<QLineEdit> itLV( listValue ); | 1231 | QListIterator<QLineEdit> itLV( listValue ); |
1228 | for ( ; itLV.current(); ++itLV ) { | 1232 | for ( ; itLV.current(); ++itLV ) { |
1229 | (*itLV)->setText( "" ); | 1233 | (*itLV)->setText( "" ); |
1230 | } | 1234 | } |
1231 | 1235 | ||
1232 | txtFirstName->setText(""); | 1236 | txtFirstName->setText(""); |
1233 | txtMiddleName->setText(""); | 1237 | txtMiddleName->setText(""); |
1234 | txtLastName->setText(""); | 1238 | txtLastName->setText(""); |
1235 | txtSuffix->setText(""); | 1239 | txtSuffix->setText(""); |
1236 | txtNote->setText(""); | 1240 | txtNote->setText(""); |
1237 | txtFullName->setText(""); | 1241 | txtFullName->setText(""); |
1238 | txtJobTitle->setText(""); | 1242 | txtJobTitle->setText(""); |
1239 | txtOrganization->setText(""); | 1243 | txtOrganization->setText(""); |
1240 | txtChooserField1->setText(""); | 1244 | txtChooserField1->setText(""); |
1241 | txtChooserField2->setText(""); | 1245 | txtChooserField2->setText(""); |
1242 | txtChooserField3->setText(""); | 1246 | txtChooserField3->setText(""); |
1243 | txtAddress->setText(""); | 1247 | txtAddress->setText(""); |
1244 | txtCity->setText(""); | 1248 | txtCity->setText(""); |
1245 | txtState->setText(""); | 1249 | txtState->setText(""); |
1246 | txtZip->setText(""); | 1250 | txtZip->setText(""); |
1247 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1251 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1248 | txtTmp->setText(""); | 1252 | txtTmp->setText(""); |
1249 | txtTmp = cmbFileAs->lineEdit(); | 1253 | txtTmp = cmbFileAs->lineEdit(); |
1250 | txtTmp->setText(""); | 1254 | txtTmp->setText(""); |
1251 | 1255 | ||
1252 | } | 1256 | } |
1253 | 1257 | ||
1254 | void ContactEditor::setEntry( const Opie::OPimContact &entry ) { | 1258 | void ContactEditor::setEntry( const Opie::OPimContact &entry ) { |
1255 | 1259 | ||
1256 | initializing = true; | 1260 | initializing = true; |
1257 | 1261 | ||
1258 | // Cleanup and activate the general Page .. | 1262 | // Cleanup and activate the general Page .. |
1259 | cleanupFields(); | 1263 | cleanupFields(); |
1260 | tabMain->setCurrentPage( 0 ); | 1264 | tabMain->setCurrentPage( 0 ); |
1261 | 1265 | ||
1262 | ent = entry; | 1266 | ent = entry; |
1263 | 1267 | ||
1264 | emails = QStringList(ent.emailList()); | 1268 | emails = QStringList(ent.emailList()); |
1265 | defaultEmail = ent.defaultEmail(); | 1269 | defaultEmail = ent.defaultEmail(); |
1266 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1270 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1267 | qDebug("default email=%s",defaultEmail.latin1()); | 1271 | Opie::Core::odebug << "default email=" << defaultEmail << oendl; |
1268 | 1272 | ||
1269 | txtFirstName->setText( ent.firstName() ); | 1273 | txtFirstName->setText( ent.firstName() ); |
1270 | txtMiddleName->setText( ent.middleName() ); | 1274 | txtMiddleName->setText( ent.middleName() ); |
1271 | txtLastName->setText( ent.lastName() ); | 1275 | txtLastName->setText( ent.lastName() ); |
1272 | txtSuffix->setText( ent.suffix() ); | 1276 | txtSuffix->setText( ent.suffix() ); |
1273 | 1277 | ||
1274 | // QString *tmpString = new QString; | 1278 | // QString *tmpString = new QString; |
1275 | // *tmpString = ent.firstName() + " " + ent.middleName() + | 1279 | // *tmpString = ent.firstName() + " " + ent.middleName() + |
1276 | // + " " + ent.lastName() + " " + ent.suffix(); | 1280 | // + " " + ent.lastName() + " " + ent.suffix(); |
1277 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1281 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1278 | 1282 | ||
1279 | if ( !ent.isEmpty() ){ | 1283 | if ( !ent.isEmpty() ){ |
1280 | // Lastnames with multiple words need to be protected by a comma ! | 1284 | // Lastnames with multiple words need to be protected by a comma ! |
1281 | if ( ent.lastName().contains( ' ', TRUE ) ) | 1285 | if ( ent.lastName().contains( ' ', TRUE ) ) |
1282 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); | 1286 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); |
1283 | else | 1287 | else |
1284 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | 1288 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); |
1285 | } | 1289 | } |
1286 | 1290 | ||
1287 | cmbFileAs->setEditText( ent.fileAs() ); | 1291 | cmbFileAs->setEditText( ent.fileAs() ); |
1288 | 1292 | ||
1289 | //if (hasTitle) | 1293 | //if (hasTitle) |
1290 | txtJobTitle->setText( ent.jobTitle() ); | 1294 | txtJobTitle->setText( ent.jobTitle() ); |
1291 | 1295 | ||
1292 | //if (hasCompany) | 1296 | //if (hasCompany) |
1293 | txtOrganization->setText( ent.company() ); | 1297 | txtOrganization->setText( ent.company() ); |
1294 | 1298 | ||
1295 | //if (hasNotes) | 1299 | //if (hasNotes) |
1296 | txtNote->setText( ent.notes() ); | 1300 | txtNote->setText( ent.notes() ); |
1297 | 1301 | ||
1298 | //if (hasStreet) { | 1302 | //if (hasStreet) { |
1299 | slHomeAddress[0] = ent.homeStreet(); | 1303 | slHomeAddress[0] = ent.homeStreet(); |
1300 | slBusinessAddress[0] = ent.businessStreet(); | 1304 | slBusinessAddress[0] = ent.businessStreet(); |
1301 | //} | 1305 | //} |
1302 | 1306 | ||
1303 | //if (hasCity) { | 1307 | //if (hasCity) { |
1304 | slHomeAddress[3] = ent.homeCity(); | 1308 | slHomeAddress[3] = ent.homeCity(); |
1305 | slBusinessAddress[3] = ent.businessCity(); | 1309 | slBusinessAddress[3] = ent.businessCity(); |
1306 | //} | 1310 | //} |
1307 | 1311 | ||
1308 | //if (hasState) { | 1312 | //if (hasState) { |
1309 | slHomeAddress[4] = ent.homeState(); | 1313 | slHomeAddress[4] = ent.homeState(); |
1310 | slBusinessAddress[4] = ent.businessState(); | 1314 | slBusinessAddress[4] = ent.businessState(); |
1311 | //} | 1315 | //} |
1312 | 1316 | ||
1313 | //if (hasZip) { | 1317 | //if (hasZip) { |
1314 | slHomeAddress[5] = ent.homeZip(); | 1318 | slHomeAddress[5] = ent.homeZip(); |
1315 | slBusinessAddress[5] = ent.businessZip(); | 1319 | slBusinessAddress[5] = ent.businessZip(); |
1316 | //} | 1320 | //} |
1317 | 1321 | ||
1318 | //if (hasCountry) { | 1322 | //if (hasCountry) { |
1319 | slHomeAddress[6] = ent.homeCountry(); | 1323 | slHomeAddress[6] = ent.homeCountry(); |
1320 | slBusinessAddress[6] = ent.businessCountry(); | 1324 | slBusinessAddress[6] = ent.businessCountry(); |
1321 | //} | 1325 | //} |
1322 | 1326 | ||
1323 | QStringList::ConstIterator it; | 1327 | QStringList::ConstIterator it; |
1324 | QListIterator<QLineEdit> itLE( listValue ); | 1328 | QListIterator<QLineEdit> itLE( listValue ); |
1325 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { | 1329 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1326 | 1330 | ||
1327 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); | 1331 | Opie::Core::owarn << " Filling dynamic Field: " << (*it) << oendl; |
1328 | 1332 | ||
1329 | if ( *it == "Department" ) | 1333 | if ( *it == "Department" ) |
1330 | (*itLE)->setText( ent.department() ); | 1334 | (*itLE)->setText( ent.department() ); |
1331 | 1335 | ||
1332 | if ( *it == "Company" ) | 1336 | if ( *it == "Company" ) |
1333 | (*itLE)->setText( ent.company() ); | 1337 | (*itLE)->setText( ent.company() ); |
1334 | 1338 | ||
1335 | if ( *it == "Office" ) | 1339 | if ( *it == "Office" ) |
1336 | (*itLE)->setText( ent.office() ); | 1340 | (*itLE)->setText( ent.office() ); |
1337 | 1341 | ||
1338 | if ( *it == "Profession" ) | 1342 | if ( *it == "Profession" ) |
1339 | (*itLE)->setText( ent.profession() ); | 1343 | (*itLE)->setText( ent.profession() ); |
1340 | 1344 | ||
1341 | if ( *it == "Assistant" ) | 1345 | if ( *it == "Assistant" ) |
1342 | (*itLE)->setText( ent.assistant() ); | 1346 | (*itLE)->setText( ent.assistant() ); |
1343 | 1347 | ||
1344 | if ( *it == "Manager" ) | 1348 | if ( *it == "Manager" ) |
1345 | (*itLE)->setText( ent.manager() ); | 1349 | (*itLE)->setText( ent.manager() ); |
1346 | 1350 | ||
1347 | if ( *it == "Spouse" ) | 1351 | if ( *it == "Spouse" ) |
1348 | (*itLE)->setText( ent.spouse() ); | 1352 | (*itLE)->setText( ent.spouse() ); |
1349 | 1353 | ||
1350 | if ( *it == "Nickname" ){ | 1354 | if ( *it == "Nickname" ){ |
1351 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); | 1355 | Opie::Core::owarn << "**** Nichname: " << ent.nickname() << oendl; |
1352 | (*itLE)->setText( ent.nickname() ); | 1356 | (*itLE)->setText( ent.nickname() ); |
1353 | } | 1357 | } |
1354 | 1358 | ||
1355 | if ( *it == "Children" ) | 1359 | if ( *it == "Children" ) |
1356 | (*itLE)->setText( ent.children() ); | 1360 | (*itLE)->setText( ent.children() ); |
1357 | 1361 | ||
1358 | } | 1362 | } |
1359 | 1363 | ||
1360 | QStringList::Iterator itV; | 1364 | QStringList::Iterator itV; |
1361 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1365 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1362 | 1366 | ||
1363 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1367 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1364 | *itV = ent.businessPhone(); | 1368 | *itV = ent.businessPhone(); |
1365 | /* | 1369 | /* |
1366 | if ( *it == "Business 2 Phone" ) | 1370 | if ( *it == "Business 2 Phone" ) |
1367 | *itV = ent.business2Phone(); | 1371 | *itV = ent.business2Phone(); |
1368 | */ | 1372 | */ |
1369 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1373 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1370 | *itV = ent.businessFax(); | 1374 | *itV = ent.businessFax(); |
1371 | 1375 | ||
1372 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1376 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1373 | *itV = ent.businessMobile(); | 1377 | *itV = ent.businessMobile(); |
1374 | /* | 1378 | /* |
1375 | if ( *it == "Company Phone" ) | 1379 | if ( *it == "Company Phone" ) |
1376 | *itV = ent.companyPhone(); | 1380 | *itV = ent.companyPhone(); |
1377 | */ | 1381 | */ |
1378 | if ( *it == "Default Email" ) | 1382 | if ( *it == "Default Email" ) |
1379 | *itV = ent.defaultEmail(); | 1383 | *itV = ent.defaultEmail(); |
1380 | 1384 | ||
1381 | if ( *it == "Emails" ) | 1385 | if ( *it == "Emails" ) |
1382 | *itV = ent.emailList().join(", "); // :SX | 1386 | *itV = ent.emailList().join(", "); // :SX |
1383 | 1387 | ||
1384 | if ( *it == "Home Phone" ) | 1388 | if ( *it == "Home Phone" ) |
1385 | *itV = ent.homePhone(); | 1389 | *itV = ent.homePhone(); |
1386 | /* | 1390 | /* |
1387 | if ( *it == "Home 2 Phone" ) | 1391 | if ( *it == "Home 2 Phone" ) |
1388 | *itV = ent.home2Phone(); | 1392 | *itV = ent.home2Phone(); |
1389 | */ | 1393 | */ |
1390 | if ( *it == "Home Fax" ) | 1394 | if ( *it == "Home Fax" ) |
1391 | *itV = ent.homeFax(); | 1395 | *itV = ent.homeFax(); |
1392 | 1396 | ||
1393 | if ( *it == "Home Mobile" ) | 1397 | if ( *it == "Home Mobile" ) |
1394 | *itV = ent.homeMobile(); | 1398 | *itV = ent.homeMobile(); |
1395 | /* | 1399 | /* |
1396 | if ( *it == "Car Phone" ) | 1400 | if ( *it == "Car Phone" ) |
1397 | *itV = ent.carPhone(); | 1401 | *itV = ent.carPhone(); |
1398 | 1402 | ||
1399 | if ( *it == "ISDN Phone" ) | 1403 | if ( *it == "ISDN Phone" ) |
1400 | *itV = ent.ISDNPhone(); | 1404 | *itV = ent.ISDNPhone(); |
1401 | 1405 | ||
1402 | if ( *it == "Other Phone" ) | 1406 | if ( *it == "Other Phone" ) |
1403 | *itV = ent.otherPhone(); | 1407 | *itV = ent.otherPhone(); |
1404 | */ | 1408 | */ |
1405 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1409 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1406 | *itV = ent.businessPager(); | 1410 | *itV = ent.businessPager(); |
1407 | /* | 1411 | /* |
1408 | if ( *it == "Home Pager") | 1412 | if ( *it == "Home Pager") |
1409 | *itV = ent.homePager(); | 1413 | *itV = ent.homePager(); |
1410 | 1414 | ||
1411 | if ( *it == "AIM IM" ) | 1415 | if ( *it == "AIM IM" ) |
1412 | *itV = ent.AIMIM(); | 1416 | *itV = ent.AIMIM(); |
1413 | 1417 | ||
1414 | if ( *it == "ICQ IM" ) | 1418 | if ( *it == "ICQ IM" ) |
1415 | *itV = ent.ICQIM(); | 1419 | *itV = ent.ICQIM(); |
1416 | 1420 | ||
1417 | if ( *it == "Jabber IM" ) | 1421 | if ( *it == "Jabber IM" ) |
1418 | *itV = ent.jabberIM(); | 1422 | *itV = ent.jabberIM(); |
1419 | 1423 | ||
1420 | if ( *it == "MSN IM" ) | 1424 | if ( *it == "MSN IM" ) |
1421 | *itV = ent.MSNIM(); | 1425 | *itV = ent.MSNIM(); |
1422 | 1426 | ||
1423 | if ( *it == "Yahoo IM" ) | 1427 | if ( *it == "Yahoo IM" ) |
1424 | *itV = ent.yahooIM(); | 1428 | *itV = ent.yahooIM(); |
1425 | */ | 1429 | */ |
1426 | if ( *it == "Home Web Page" ) | 1430 | if ( *it == "Home Web Page" ) |
1427 | *itV = ent.homeWebpage(); | 1431 | *itV = ent.homeWebpage(); |
1428 | 1432 | ||
1429 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1433 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1430 | *itV = ent.businessWebpage(); | 1434 | *itV = ent.businessWebpage(); |
1431 | 1435 | ||
1432 | 1436 | ||
1433 | } | 1437 | } |
1434 | 1438 | ||
1435 | 1439 | ||
1436 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1440 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1437 | 1441 | ||
1438 | QString gender = ent.gender(); | 1442 | QString gender = ent.gender(); |
1439 | cmbGender->setCurrentItem( gender.toInt() ); | 1443 | cmbGender->setCurrentItem( gender.toInt() ); |
1440 | 1444 | ||
1441 | txtNote->setText( ent.notes() ); | 1445 | txtNote->setText( ent.notes() ); |
1442 | 1446 | ||
1443 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1447 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1444 | 1448 | ||
1445 | // Get combo-settings from contact and set preset.. | 1449 | // Get combo-settings from contact and set preset.. |
1446 | contactfields.loadFromRecord( ent ); | 1450 | contactfields.loadFromRecord( ent ); |
1447 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); | 1451 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); |
1448 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); | 1452 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); |
1449 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); | 1453 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); |
1450 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); | 1454 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); |
1451 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); | 1455 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); |
1452 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1456 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1453 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1457 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1454 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1458 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1455 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); | 1459 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); |
1456 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1460 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1457 | 1461 | ||
1458 | updateDatePicker(); | 1462 | updateDatePicker(); |
1459 | 1463 | ||
1460 | initializing = false; | 1464 | initializing = false; |
1461 | } | 1465 | } |
1462 | void ContactEditor::updateDatePicker() | 1466 | void ContactEditor::updateDatePicker() |
1463 | { | 1467 | { |
1464 | // Set DatePicker | 1468 | // Set DatePicker |
1465 | if ( !ent.birthday().isNull() ){ | 1469 | if ( !ent.birthday().isNull() ){ |
1466 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); | 1470 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); |
1467 | birthdayPicker->setDate( ent.birthday() ); | 1471 | birthdayPicker->setDate( ent.birthday() ); |
1468 | } else | 1472 | } else |
1469 | birthdayButton->setText( tr ("Unknown") ); | 1473 | birthdayButton->setText( tr ("Unknown") ); |
1470 | 1474 | ||
1471 | if ( !ent.anniversary().isNull() ){ | 1475 | if ( !ent.anniversary().isNull() ){ |
1472 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); | 1476 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); |
1473 | anniversaryPicker->setDate( ent.anniversary() ); | 1477 | anniversaryPicker->setDate( ent.anniversary() ); |
1474 | } else | 1478 | } else |
1475 | anniversaryButton->setText( tr ("Unknown") ); | 1479 | anniversaryButton->setText( tr ("Unknown") ); |
1476 | 1480 | ||
1477 | } | 1481 | } |
1478 | 1482 | ||
1479 | void ContactEditor::saveEntry() { | 1483 | void ContactEditor::saveEntry() { |
1480 | 1484 | ||
1481 | // Store current combo into contact | 1485 | // Store current combo into contact |
1482 | contactfields.saveToRecord( ent ); | 1486 | contactfields.saveToRecord( ent ); |
1483 | 1487 | ||
1484 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1488 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1485 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1489 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1486 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1490 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1487 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1491 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1488 | 1492 | ||
1489 | ent.setFirstName( txtFirstName->text() ); | 1493 | ent.setFirstName( txtFirstName->text() ); |
1490 | ent.setLastName( txtLastName->text() ); | 1494 | ent.setLastName( txtLastName->text() ); |
1491 | ent.setMiddleName( txtMiddleName->text() ); | 1495 | ent.setMiddleName( txtMiddleName->text() ); |
1492 | ent.setSuffix( txtSuffix->text() ); | 1496 | ent.setSuffix( txtSuffix->text() ); |
1493 | 1497 | ||
1494 | ent.setFileAs( cmbFileAs->currentText() ); | 1498 | ent.setFileAs( cmbFileAs->currentText() ); |
1495 | 1499 | ||
1496 | ent.setCategories( cmbCat->currentCategories() ); | 1500 | ent.setCategories( cmbCat->currentCategories() ); |
1497 | 1501 | ||
1498 | 1502 | ||
1499 | //if (hasTitle) | 1503 | //if (hasTitle) |
1500 | ent.setJobTitle( txtJobTitle->text() ); | 1504 | ent.setJobTitle( txtJobTitle->text() ); |
1501 | 1505 | ||
1502 | //if (hasCompany) | 1506 | //if (hasCompany) |
1503 | ent.setCompany( txtOrganization->text() ); | 1507 | ent.setCompany( txtOrganization->text() ); |
1504 | 1508 | ||
1505 | //if (hasNotes) | 1509 | //if (hasNotes) |
1506 | ent.setNotes( txtNote->text() ); | 1510 | ent.setNotes( txtNote->text() ); |
1507 | 1511 | ||
1508 | //if (hasStreet) { | 1512 | //if (hasStreet) { |
1509 | ent.setHomeStreet( slHomeAddress[0] ); | 1513 | ent.setHomeStreet( slHomeAddress[0] ); |
1510 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1514 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1511 | //} | 1515 | //} |
1512 | 1516 | ||
1513 | //if (hasCity) { | 1517 | //if (hasCity) { |
1514 | ent.setHomeCity( slHomeAddress[3] ); | 1518 | ent.setHomeCity( slHomeAddress[3] ); |
1515 | ent.setBusinessCity( slBusinessAddress[3] ); | 1519 | ent.setBusinessCity( slBusinessAddress[3] ); |
1516 | //} | 1520 | //} |
1517 | 1521 | ||
1518 | //if (hasState) { | 1522 | //if (hasState) { |
1519 | ent.setHomeState( slHomeAddress[4] ); | 1523 | ent.setHomeState( slHomeAddress[4] ); |
1520 | ent.setBusinessState( slBusinessAddress[4] ); | 1524 | ent.setBusinessState( slBusinessAddress[4] ); |
1521 | //} | 1525 | //} |
1522 | 1526 | ||
1523 | //if (hasZip) { | 1527 | //if (hasZip) { |
1524 | ent.setHomeZip( slHomeAddress[5] ); | 1528 | ent.setHomeZip( slHomeAddress[5] ); |
1525 | ent.setBusinessZip( slBusinessAddress[5] ); | 1529 | ent.setBusinessZip( slBusinessAddress[5] ); |
1526 | //} | 1530 | //} |
1527 | 1531 | ||
1528 | //if (hasCountry) { | 1532 | //if (hasCountry) { |
1529 | ent.setHomeCountry( slHomeAddress[6] ); | 1533 | ent.setHomeCountry( slHomeAddress[6] ); |
1530 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1534 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1531 | //} | 1535 | //} |
1532 | 1536 | ||
1533 | QStringList::ConstIterator it; | 1537 | QStringList::ConstIterator it; |
1534 | QListIterator<QLineEdit> itLE( listValue ); | 1538 | QListIterator<QLineEdit> itLE( listValue ); |
1535 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { | 1539 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { |
1536 | 1540 | ||
1537 | if ( *it == "Department" ) | 1541 | if ( *it == "Department" ) |
1538 | ent.setDepartment( (*itLE)->text() ); | 1542 | ent.setDepartment( (*itLE)->text() ); |
1539 | 1543 | ||
1540 | if ( *it == "Company" ) | 1544 | if ( *it == "Company" ) |
1541 | ent.setCompany( (*itLE)->text() ); | 1545 | ent.setCompany( (*itLE)->text() ); |
1542 | 1546 | ||
1543 | if ( *it == "Office" ) | 1547 | if ( *it == "Office" ) |
1544 | ent.setOffice( (*itLE)->text() ); | 1548 | ent.setOffice( (*itLE)->text() ); |
1545 | 1549 | ||
1546 | if ( *it == "Profession" ) | 1550 | if ( *it == "Profession" ) |
1547 | ent.setProfession( (*itLE)->text() ); | 1551 | ent.setProfession( (*itLE)->text() ); |
1548 | 1552 | ||
1549 | if ( *it == "Assistant" ) | 1553 | if ( *it == "Assistant" ) |
1550 | ent.setAssistant( (*itLE)->text() ); | 1554 | ent.setAssistant( (*itLE)->text() ); |
1551 | 1555 | ||
1552 | if ( *it == "Manager" ) | 1556 | if ( *it == "Manager" ) |
1553 | ent.setManager( (*itLE)->text() ); | 1557 | ent.setManager( (*itLE)->text() ); |
1554 | 1558 | ||
1555 | if ( *it == "Spouse" ) | 1559 | if ( *it == "Spouse" ) |
1556 | ent.setSpouse( (*itLE)->text() ); | 1560 | ent.setSpouse( (*itLE)->text() ); |
1557 | 1561 | ||
1558 | if ( *it == "Nickname" ) | 1562 | if ( *it == "Nickname" ) |
1559 | ent.setNickname( (*itLE)->text() ); | 1563 | ent.setNickname( (*itLE)->text() ); |
1560 | 1564 | ||
1561 | if ( *it == "Children" ) | 1565 | if ( *it == "Children" ) |
1562 | ent.setChildren( (*itLE)->text() ); | 1566 | ent.setChildren( (*itLE)->text() ); |
1563 | 1567 | ||
1564 | } | 1568 | } |
1565 | 1569 | ||
1566 | 1570 | ||
1567 | QStringList::ConstIterator itV; | 1571 | QStringList::ConstIterator itV; |
1568 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1572 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1569 | 1573 | ||
1570 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1574 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1571 | ent.setBusinessPhone( *itV ); | 1575 | ent.setBusinessPhone( *itV ); |
1572 | 1576 | ||
1573 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1577 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1574 | ent.setBusinessFax( *itV ); | 1578 | ent.setBusinessFax( *itV ); |
1575 | 1579 | ||
1576 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1580 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1577 | ent.setBusinessMobile( *itV ); | 1581 | ent.setBusinessMobile( *itV ); |
1578 | 1582 | ||
1579 | if ( *it == "Emails" ){ | 1583 | if ( *it == "Emails" ){ |
1580 | QString allemail; | 1584 | QString allemail; |
1581 | QString defaultmail; | 1585 | QString defaultmail; |
1582 | parseEmailFrom( emails.join(","), defaultmail, allemail ); | 1586 | parseEmailFrom( emails.join(","), defaultmail, allemail ); |
1583 | if ( defaultEmail.isEmpty() ){ | 1587 | if ( defaultEmail.isEmpty() ){ |
1584 | qWarning("Default email was not set by user!"); | 1588 | Opie::Core::owarn << "Default email was not set by user!" << oendl; |
1585 | qWarning("Using first email in list: %s", defaultmail.latin1()); | 1589 | Opie::Core::owarn << "Using first email in list: " << defaultmail << oendl; |
1586 | ent.setDefaultEmail( defaultmail ); | 1590 | ent.setDefaultEmail( defaultmail ); |
1587 | } | 1591 | } |
1588 | ent.setEmails( allemail ); | 1592 | ent.setEmails( allemail ); |
1589 | } | 1593 | } |
1590 | 1594 | ||
1591 | if ( *it == "Default Email") | 1595 | if ( *it == "Default Email") |
1592 | ent.setDefaultEmail( defaultEmail /* *itV */ ); | 1596 | ent.setDefaultEmail( defaultEmail /* *itV */ ); |
1593 | 1597 | ||
1594 | if ( *it == "Home Phone" ) | 1598 | if ( *it == "Home Phone" ) |
1595 | ent.setHomePhone( *itV ); | 1599 | ent.setHomePhone( *itV ); |
1596 | 1600 | ||
1597 | if ( *it == "Home Fax" ) | 1601 | if ( *it == "Home Fax" ) |
1598 | ent.setHomeFax( *itV ); | 1602 | ent.setHomeFax( *itV ); |
1599 | 1603 | ||
1600 | if ( *it == "Home Mobile" ) | 1604 | if ( *it == "Home Mobile" ) |
1601 | ent.setHomeMobile( *itV ); | 1605 | ent.setHomeMobile( *itV ); |
1602 | 1606 | ||
1603 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1607 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1604 | ent.setBusinessPager( *itV ); | 1608 | ent.setBusinessPager( *itV ); |
1605 | 1609 | ||
1606 | if ( *it == "Home Web Page" ) | 1610 | if ( *it == "Home Web Page" ) |
1607 | ent.setHomeWebpage( *itV ); | 1611 | ent.setHomeWebpage( *itV ); |
1608 | 1612 | ||
1609 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1613 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1610 | ent.setBusinessWebpage( *itV ); | 1614 | ent.setBusinessWebpage( *itV ); |
1611 | 1615 | ||
1612 | 1616 | ||
1613 | } | 1617 | } |
1614 | 1618 | ||
1615 | int gender = cmbGender->currentItem(); | 1619 | int gender = cmbGender->currentItem(); |
1616 | ent.setGender( QString::number( gender ) ); | 1620 | ent.setGender( QString::number( gender ) ); |
1617 | 1621 | ||
1618 | QString str = txtNote->text(); | 1622 | QString str = txtNote->text(); |
1619 | if ( !str.isNull() ) | 1623 | if ( !str.isNull() ) |
1620 | ent.setNotes( str ); | 1624 | ent.setNotes( str ); |
1621 | 1625 | ||
1622 | } | 1626 | } |
1623 | 1627 | ||
1624 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1628 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1625 | QString &strAll ) | 1629 | QString &strAll ) |
1626 | { | 1630 | { |
1627 | int where, | 1631 | int where, |
1628 | start; | 1632 | start; |
1629 | if ( txt.isEmpty() ) | 1633 | if ( txt.isEmpty() ) |
1630 | return; | 1634 | return; |
1631 | // find the first | 1635 | // find the first |
1632 | where = txt.find( ',' ); | 1636 | where = txt.find( ',' ); |
1633 | if ( where < 0 ) { | 1637 | if ( where < 0 ) { |
1634 | strDefaultEmail = txt; | 1638 | strDefaultEmail = txt; |
1635 | strAll = txt; | 1639 | strAll = txt; |
1636 | } else { | 1640 | } else { |
1637 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1641 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1638 | strAll = strDefaultEmail; | 1642 | strAll = strDefaultEmail; |
1639 | while ( where > -1 ) { | 1643 | while ( where > -1 ) { |
1640 | strAll.append(" "); | 1644 | strAll.append(" "); |
1641 | start = where; | 1645 | start = where; |
1642 | where = txt.find( ',', where + 1 ); | 1646 | where = txt.find( ',', where + 1 ); |
1643 | if ( where > - 1 ) | 1647 | if ( where > - 1 ) |
1644 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1648 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1645 | else // grab until the end... | 1649 | else // grab until the end... |
1646 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1650 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1647 | } | 1651 | } |
1648 | } | 1652 | } |
1649 | } | 1653 | } |
1650 | 1654 | ||
1651 | void parseEmailTo( const QString &strDefaultEmail, | 1655 | void parseEmailTo( const QString &strDefaultEmail, |
1652 | const QString &strOtherEmail, QString &strBack ) | 1656 | const QString &strOtherEmail, QString &strBack ) |
1653 | { | 1657 | { |
1654 | // create a comma dilimeted set of emails... | 1658 | // create a comma dilimeted set of emails... |
1655 | // use the power of short circuiting... | 1659 | // use the power of short circuiting... |
1656 | bool foundDefault = false; | 1660 | bool foundDefault = false; |
1657 | QString strTmp; | 1661 | QString strTmp; |
1658 | int start = 0; | 1662 | int start = 0; |
1659 | int where; | 1663 | int where; |
1660 | // start at the beginng. | 1664 | // start at the beginng. |
1661 | strBack = strDefaultEmail; | 1665 | strBack = strDefaultEmail; |
1662 | where = 0; | 1666 | where = 0; |
1663 | while ( where > -1 ) { | 1667 | while ( where > -1 ) { |
1664 | start = where; | 1668 | start = where; |
1665 | where = strOtherEmail.find( ' ', where + 1 ); | 1669 | where = strOtherEmail.find( ' ', where + 1 ); |
1666 | if ( where > 0 ) { | 1670 | if ( where > 0 ) { |
1667 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1671 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1668 | } else | 1672 | } else |
1669 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 1673 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
1670 | if ( foundDefault || strTmp != strDefaultEmail ) { | 1674 | if ( foundDefault || strTmp != strDefaultEmail ) { |
1671 | strBack.append( ", " ); | 1675 | strBack.append( ", " ); |
1672 | strBack.append( strTmp ); | 1676 | strBack.append( strTmp ); |
1673 | } else | 1677 | } else |
1674 | foundDefault = true; | 1678 | foundDefault = true; |
1675 | } | 1679 | } |
1676 | } | 1680 | } |
1677 | 1681 | ||
1678 | 1682 | ||
1679 | static inline bool containsAlphaNum( const QString &str ) | 1683 | static inline bool containsAlphaNum( const QString &str ) |
1680 | { | 1684 | { |
1681 | int i, | 1685 | int i, |
1682 | count = str.length(); | 1686 | count = str.length(); |
1683 | for ( i = 0; i < count; i++ ) | 1687 | for ( i = 0; i < count; i++ ) |
1684 | if ( !str[i].isSpace() ) | 1688 | if ( !str[i].isSpace() ) |
1685 | return TRUE; | 1689 | return TRUE; |
1686 | return FALSE; | 1690 | return FALSE; |
1687 | } | 1691 | } |
1688 | 1692 | ||
1689 | static inline bool constainsWhiteSpace( const QString &str ) | 1693 | static inline bool constainsWhiteSpace( const QString &str ) |
1690 | { | 1694 | { |
1691 | int i, | 1695 | int i, |
1692 | count = str.length(); | 1696 | count = str.length(); |
1693 | for (i = 0; i < count; i++ ) | 1697 | for (i = 0; i < count; i++ ) |
1694 | if ( str[i].isSpace() ) | 1698 | if ( str[i].isSpace() ) |
1695 | return TRUE; | 1699 | return TRUE; |
1696 | return FALSE; | 1700 | return FALSE; |
1697 | } | 1701 | } |
1698 | 1702 | ||
1699 | void ContactEditor::setPersonalView( bool personal ) | 1703 | void ContactEditor::setPersonalView( bool personal ) |
1700 | { | 1704 | { |
1701 | m_personalView = personal; | 1705 | m_personalView = personal; |
1702 | 1706 | ||
1703 | // Currently disbled due to the fact that | 1707 | // Currently disbled due to the fact that |
1704 | // show will not work... | 1708 | // show will not work... |
1705 | return; | 1709 | return; |
1706 | 1710 | ||
1707 | if ( personal ){ | 1711 | if ( personal ){ |
1708 | cmbCat->hide(); | 1712 | cmbCat->hide(); |
1709 | labCat->hide(); | 1713 | labCat->hide(); |
1710 | 1714 | ||
1711 | } else{ | 1715 | } else{ |
1712 | cmbCat->show(); | 1716 | cmbCat->show(); |
1713 | labCat->show(); | 1717 | labCat->show(); |
1714 | } | 1718 | } |
1715 | } | 1719 | } |
1716 | 1720 | ||
1717 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) | 1721 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) |
1718 | { | 1722 | { |
1719 | QDate date; | 1723 | QDate date; |
1720 | date.setYMD( year, month, day ); | 1724 | date.setYMD( year, month, day ); |
1721 | QString dateString = TimeString::numberDateString( date ); | 1725 | QString dateString = TimeString::numberDateString( date ); |
1722 | anniversaryButton->setText( dateString ); | 1726 | anniversaryButton->setText( dateString ); |
1723 | ent.setAnniversary ( date ); | 1727 | ent.setAnniversary ( date ); |
1724 | } | 1728 | } |
1725 | 1729 | ||
1726 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) | 1730 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) |
1727 | { | 1731 | { |
1728 | QDate date; | 1732 | QDate date; |
1729 | date.setYMD( year, month, day ); | 1733 | date.setYMD( year, month, day ); |
1730 | QString dateString = TimeString::numberDateString( date ); | 1734 | QString dateString = TimeString::numberDateString( date ); |
1731 | birthdayButton->setText( dateString ); | 1735 | birthdayButton->setText( dateString ); |
1732 | ent.setBirthday ( date ); | 1736 | ent.setBirthday ( date ); |
1733 | } | 1737 | } |
1734 | 1738 | ||
1735 | void ContactEditor::slotRemoveBirthday() | 1739 | void ContactEditor::slotRemoveBirthday() |
1736 | { | 1740 | { |
1737 | qWarning("void ContactEditor::slotRemoveBirthday()"); | 1741 | Opie::Core::owarn << "void ContactEditor::slotRemoveBirthday()" << oendl; |
1738 | ent.setBirthday( QDate() ); | 1742 | ent.setBirthday( QDate() ); |
1739 | updateDatePicker(); | 1743 | updateDatePicker(); |
1740 | } | 1744 | } |
1741 | 1745 | ||
1742 | void ContactEditor::slotRemoveAnniversary() | 1746 | void ContactEditor::slotRemoveAnniversary() |
1743 | { | 1747 | { |
1744 | qWarning("void ContactEditor::slotRemoveAnniversary()"); | 1748 | Opie::Core::owarn << "void ContactEditor::slotRemoveAnniversary()" << oendl; |
1745 | ent.setAnniversary( QDate() ); | 1749 | ent.setAnniversary( QDate() ); |
1746 | updateDatePicker(); | 1750 | updateDatePicker(); |
1747 | } | 1751 | } |
diff --git a/core/pim/addressbook/opie-addressbook.control b/core/pim/addressbook/opie-addressbook.control index 18a3791..882bdf3 100644 --- a/core/pim/addressbook/opie-addressbook.control +++ b/core/pim/addressbook/opie-addressbook.control | |||
@@ -1,11 +1,11 @@ | |||
1 | Package: opie-addressbook | 1 | Package: opie-addressbook |
2 | Files: plugins/application/libaddressbook.so* bin/addressbook apps/1Pim/addressbook.desktop | 2 | Files: plugins/application/libaddressbook.so* bin/addressbook apps/1Pim/addressbook.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/pim | 4 | Section: opie/pim |
5 | Conflicts: qpe-tkcaddressbook | 5 | Conflicts: qpe-tkcaddressbook |
6 | Maintainer: Stefan Eilers <eilers.stefan@epost.de> | 6 | Maintainer: Stefan Eilers <eilers.stefan@epost.de> |
7 | Architecture: arm | 7 | Architecture: arm |
8 | Depends: task-opie-minimal, opie-pics, libopiecore2, libopieui2, libopiepim2, libopiedb2 | 8 | Depends: task-opie-minimal, opie-pics, libopiecore2, libopieui2, libopiepim2 |
9 | Description: Contacts | 9 | Description: Contacts |
10 | A simple addressbook for the Opie environment. | 10 | A simple addressbook for the Opie environment. |
11 | Version: $QPE_VERSION$EXTRAVERSION | 11 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/core/pim/addressbook/picker.cpp b/core/pim/addressbook/picker.cpp index 7a20591..df3d6ac 100644 --- a/core/pim/addressbook/picker.cpp +++ b/core/pim/addressbook/picker.cpp | |||
@@ -1,243 +1,245 @@ | |||
1 | #include "picker.h" | 1 | #include "picker.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | ||
4 | |||
3 | #include <qtimer.h> | 5 | #include <qtimer.h> |
4 | #include <qlayout.h> | 6 | #include <qlayout.h> |
5 | 7 | ||
6 | char PickerLabel::lastLetter = '\0'; | 8 | char PickerLabel::lastLetter = '\0'; |
7 | 9 | ||
8 | PickerLabel::PickerLabel( QWidget *parent, const char *name ) | 10 | PickerLabel::PickerLabel( QWidget *parent, const char *name ) |
9 | : QLabel ( parent, name ) | 11 | : QLabel ( parent, name ) |
10 | { | 12 | { |
11 | currentLetter = 0; | 13 | currentLetter = 0; |
12 | //lastLetter = 0; | 14 | //lastLetter = 0; |
13 | 15 | ||
14 | letter1 = '\0'; | 16 | letter1 = '\0'; |
15 | letter2 = '\0'; | 17 | letter2 = '\0'; |
16 | letter3 = '\0'; | 18 | letter3 = '\0'; |
17 | 19 | ||
18 | // setFont( QFont( "smallsmooth", 9 ) ); | 20 | // setFont( QFont( "smallsmooth", 9 ) ); |
19 | setFont( QFont::defaultFont() ); | 21 | setFont( QFont::defaultFont() ); |
20 | setTextFormat( Qt::RichText ); | 22 | setTextFormat( Qt::RichText ); |
21 | 23 | ||
22 | } | 24 | } |
23 | 25 | ||
24 | PickerLabel::~PickerLabel() | 26 | PickerLabel::~PickerLabel() |
25 | { | 27 | { |
26 | 28 | ||
27 | } | 29 | } |
28 | 30 | ||
29 | void PickerLabel::setLetters( char ch1, char ch2, char ch3 ) | 31 | void PickerLabel::setLetters( char ch1, char ch2, char ch3 ) |
30 | { | 32 | { |
31 | QString tmpStr; | 33 | QString tmpStr; |
32 | 34 | ||
33 | if (ch1 != '\0') | 35 | if (ch1 != '\0') |
34 | letter1 = ch1; | 36 | letter1 = ch1; |
35 | else | 37 | else |
36 | letter1 = ' '; | 38 | letter1 = ' '; |
37 | 39 | ||
38 | if (ch2 != '\0') | 40 | if (ch2 != '\0') |
39 | letter2 = ch2; | 41 | letter2 = ch2; |
40 | else | 42 | else |
41 | letter2 = ' '; | 43 | letter2 = ' '; |
42 | 44 | ||
43 | if (ch3 != '\0') | 45 | if (ch3 != '\0') |
44 | letter3 = ch3; | 46 | letter3 = ch3; |
45 | else | 47 | else |
46 | letter3 = ' '; | 48 | letter3 = ' '; |
47 | 49 | ||
48 | tmpStr = "<qt>"; | 50 | tmpStr = "<qt>"; |
49 | tmpStr += letter1; | 51 | tmpStr += letter1; |
50 | tmpStr += letter2; | 52 | tmpStr += letter2; |
51 | tmpStr += letter3; | 53 | tmpStr += letter3; |
52 | tmpStr += "</qt>"; | 54 | tmpStr += "</qt>"; |
53 | 55 | ||
54 | setText(tmpStr); | 56 | setText(tmpStr); |
55 | 57 | ||
56 | currentLetter = 0; | 58 | currentLetter = 0; |
57 | 59 | ||
58 | } | 60 | } |
59 | 61 | ||
60 | void PickerLabel::clearLetter() | 62 | void PickerLabel::clearLetter() |
61 | { | 63 | { |
62 | 64 | ||
63 | QString tmpStr; | 65 | QString tmpStr; |
64 | 66 | ||
65 | tmpStr = "<qt>"; | 67 | tmpStr = "<qt>"; |
66 | tmpStr += letter1; | 68 | tmpStr += letter1; |
67 | tmpStr += letter2; | 69 | tmpStr += letter2; |
68 | tmpStr += letter3; | 70 | tmpStr += letter3; |
69 | tmpStr += "</qt>"; | 71 | tmpStr += "</qt>"; |
70 | 72 | ||
71 | setText(tmpStr); | 73 | setText(tmpStr); |
72 | 74 | ||
73 | currentLetter = 0; | 75 | currentLetter = 0; |
74 | 76 | ||
75 | } | 77 | } |
76 | 78 | ||
77 | void PickerLabel::mousePressEvent( QMouseEvent* e ) | 79 | void PickerLabel::mousePressEvent( QMouseEvent* e ) |
78 | { | 80 | { |
79 | // If one pickerlabel is was, and an other is now selected, we | 81 | // If one pickerlabel is was, and an other is now selected, we |
80 | // have to simulate the releaseevent.. Otherwise the new label | 82 | // have to simulate the releaseevent.. Otherwise the new label |
81 | // will not get a highlighted letter.. | 83 | // will not get a highlighted letter.. |
82 | // Maybe there is a more intelligent solution, but this works and I am tired.. (se) | 84 | // Maybe there is a more intelligent solution, but this works and I am tired.. (se) |
83 | if ( ( currentLetter == 0 ) && ( lastLetter != '\0' ) ) mouseReleaseEvent( e ); | 85 | if ( ( currentLetter == 0 ) && ( lastLetter != '\0' ) ) mouseReleaseEvent( e ); |
84 | } | 86 | } |
85 | 87 | ||
86 | void PickerLabel::mouseReleaseEvent( QMouseEvent* /* e */ ) | 88 | void PickerLabel::mouseReleaseEvent( QMouseEvent* /* e */ ) |
87 | { | 89 | { |
88 | QString tmpStr; | 90 | QString tmpStr; |
89 | 91 | ||
90 | if (lastLetter != letter1 && lastLetter != letter2 && lastLetter != letter3 && lastLetter != '\0') | 92 | if (lastLetter != letter1 && lastLetter != letter2 && lastLetter != letter3 && lastLetter != '\0') |
91 | QTimer::singleShot( 0, this, SLOT(emitClearSignal()) ); | 93 | QTimer::singleShot( 0, this, SLOT(emitClearSignal()) ); |
92 | 94 | ||
93 | switch (currentLetter) { | 95 | switch (currentLetter) { |
94 | case 0: | 96 | case 0: |
95 | tmpStr = "<qt><u><b><font color=\"#FF00FF\">"; | 97 | tmpStr = "<qt><u><b><font color=\"#FF00FF\">"; |
96 | tmpStr += letter1; | 98 | tmpStr += letter1; |
97 | tmpStr += "</font></b></u>"; | 99 | tmpStr += "</font></b></u>"; |
98 | tmpStr += letter2; | 100 | tmpStr += letter2; |
99 | tmpStr += letter3; | 101 | tmpStr += letter3; |
100 | tmpStr += "</qt>"; | 102 | tmpStr += "</qt>"; |
101 | 103 | ||
102 | setText(tmpStr); | 104 | setText(tmpStr); |
103 | 105 | ||
104 | currentLetter++; | 106 | currentLetter++; |
105 | lastLetter = letter1; | 107 | lastLetter = letter1; |
106 | emit selectedLetter( letter1 ); | 108 | emit selectedLetter( letter1 ); |
107 | break; | 109 | break; |
108 | 110 | ||
109 | case 1: | 111 | case 1: |
110 | tmpStr = "<qt>"; | 112 | tmpStr = "<qt>"; |
111 | tmpStr += letter1; | 113 | tmpStr += letter1; |
112 | tmpStr += "<u><b><font color=\"#FF00FF\">"; | 114 | tmpStr += "<u><b><font color=\"#FF00FF\">"; |
113 | tmpStr += letter2; | 115 | tmpStr += letter2; |
114 | tmpStr += "</font></b></u>"; | 116 | tmpStr += "</font></b></u>"; |
115 | tmpStr += letter3; | 117 | tmpStr += letter3; |
116 | tmpStr += "</qt>"; | 118 | tmpStr += "</qt>"; |
117 | 119 | ||
118 | setText(tmpStr); | 120 | setText(tmpStr); |
119 | 121 | ||
120 | currentLetter++; | 122 | currentLetter++; |
121 | lastLetter = letter2; | 123 | lastLetter = letter2; |
122 | emit selectedLetter( letter2 ); | 124 | emit selectedLetter( letter2 ); |
123 | break; | 125 | break; |
124 | 126 | ||
125 | case 2: | 127 | case 2: |
126 | tmpStr = "<qt>"; | 128 | tmpStr = "<qt>"; |
127 | tmpStr += letter1; | 129 | tmpStr += letter1; |
128 | tmpStr += letter2; | 130 | tmpStr += letter2; |
129 | tmpStr += "<u><b><font color=\"#FF00FF\">"; | 131 | tmpStr += "<u><b><font color=\"#FF00FF\">"; |
130 | tmpStr += letter3; | 132 | tmpStr += letter3; |
131 | tmpStr += "</font></b></u></qt>"; | 133 | tmpStr += "</font></b></u></qt>"; |
132 | 134 | ||
133 | setText(tmpStr); | 135 | setText(tmpStr); |
134 | 136 | ||
135 | currentLetter++; | 137 | currentLetter++; |
136 | lastLetter = letter3; | 138 | lastLetter = letter3; |
137 | emit selectedLetter( letter3 ); | 139 | emit selectedLetter( letter3 ); |
138 | break; | 140 | break; |
139 | 141 | ||
140 | default: | 142 | default: |
141 | clearLetter(); | 143 | clearLetter(); |
142 | lastLetter = '\0'; | 144 | lastLetter = '\0'; |
143 | emit selectedLetter( '\0' ); | 145 | emit selectedLetter( '\0' ); |
144 | 146 | ||
145 | 147 | ||
146 | } | 148 | } |
147 | } | 149 | } |
148 | 150 | ||
149 | void PickerLabel::emitClearSignal() { | 151 | void PickerLabel::emitClearSignal() { |
150 | emit clearAll(); | 152 | emit clearAll(); |
151 | } | 153 | } |
152 | 154 | ||
153 | LetterPicker::LetterPicker( QWidget *parent, const char *name ) | 155 | LetterPicker::LetterPicker( QWidget *parent, const char *name ) |
154 | : QFrame( parent, name ) | 156 | : QFrame( parent, name ) |
155 | { | 157 | { |
156 | QHBoxLayout *l = new QHBoxLayout(this); | 158 | QHBoxLayout *l = new QHBoxLayout(this); |
157 | 159 | ||
158 | lblABC = new PickerLabel( this ); | 160 | lblABC = new PickerLabel( this ); |
159 | l->addWidget( lblABC ); | 161 | l->addWidget( lblABC ); |
160 | 162 | ||
161 | lblDEF = new PickerLabel( this ); | 163 | lblDEF = new PickerLabel( this ); |
162 | l->addWidget( lblDEF ); | 164 | l->addWidget( lblDEF ); |
163 | 165 | ||
164 | lblGHI = new PickerLabel( this ); | 166 | lblGHI = new PickerLabel( this ); |
165 | l->addWidget( lblGHI ); | 167 | l->addWidget( lblGHI ); |
166 | 168 | ||
167 | lblJKL = new PickerLabel( this ); | 169 | lblJKL = new PickerLabel( this ); |
168 | l->addWidget( lblJKL ); | 170 | l->addWidget( lblJKL ); |
169 | 171 | ||
170 | lblMNO = new PickerLabel( this ); | 172 | lblMNO = new PickerLabel( this ); |
171 | l->addWidget( lblMNO ); | 173 | l->addWidget( lblMNO ); |
172 | 174 | ||
173 | lblPQR = new PickerLabel( this ); | 175 | lblPQR = new PickerLabel( this ); |
174 | l->addWidget( lblPQR ); | 176 | l->addWidget( lblPQR ); |
175 | 177 | ||
176 | lblSTU = new PickerLabel( this ); | 178 | lblSTU = new PickerLabel( this ); |
177 | l->addWidget( lblSTU ); | 179 | l->addWidget( lblSTU ); |
178 | 180 | ||
179 | lblVWX = new PickerLabel( this ); | 181 | lblVWX = new PickerLabel( this ); |
180 | l->addWidget( lblVWX ); | 182 | l->addWidget( lblVWX ); |
181 | 183 | ||
182 | lblYZ = new PickerLabel( this ); | 184 | lblYZ = new PickerLabel( this ); |
183 | l->addWidget( lblYZ ); | 185 | l->addWidget( lblYZ ); |
184 | 186 | ||
185 | lblABC->setLetters( 'A', 'B', 'C' ); | 187 | lblABC->setLetters( 'A', 'B', 'C' ); |
186 | lblDEF->setLetters( 'D', 'E', 'F' ); | 188 | lblDEF->setLetters( 'D', 'E', 'F' ); |
187 | lblGHI->setLetters( 'G', 'H', 'I' ); | 189 | lblGHI->setLetters( 'G', 'H', 'I' ); |
188 | lblJKL->setLetters( 'J', 'K', 'L' ); | 190 | lblJKL->setLetters( 'J', 'K', 'L' ); |
189 | lblMNO->setLetters( 'M', 'N', 'O' ); | 191 | lblMNO->setLetters( 'M', 'N', 'O' ); |
190 | lblPQR->setLetters( 'P', 'Q', 'R' ); | 192 | lblPQR->setLetters( 'P', 'Q', 'R' ); |
191 | lblSTU->setLetters( 'S', 'T', 'U' ); | 193 | lblSTU->setLetters( 'S', 'T', 'U' ); |
192 | lblVWX->setLetters( 'V', 'W', 'X' ); | 194 | lblVWX->setLetters( 'V', 'W', 'X' ); |
193 | lblYZ->setLetters( 'Y', 'Z', '#' ); | 195 | lblYZ->setLetters( 'Y', 'Z', '#' ); |
194 | 196 | ||
195 | connect(lblABC, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 197 | connect(lblABC, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
196 | connect(lblDEF, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 198 | connect(lblDEF, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
197 | connect(lblGHI, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 199 | connect(lblGHI, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
198 | connect(lblJKL, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 200 | connect(lblJKL, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
199 | connect(lblMNO, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 201 | connect(lblMNO, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
200 | connect(lblPQR, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 202 | connect(lblPQR, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
201 | connect(lblSTU, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 203 | connect(lblSTU, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
202 | connect(lblVWX, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 204 | connect(lblVWX, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
203 | connect(lblYZ, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 205 | connect(lblYZ, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
204 | connect(lblABC, SIGNAL(clearAll()), this, SLOT(clear())); | 206 | connect(lblABC, SIGNAL(clearAll()), this, SLOT(clear())); |
205 | connect(lblDEF, SIGNAL(clearAll()), this, SLOT(clear())); | 207 | connect(lblDEF, SIGNAL(clearAll()), this, SLOT(clear())); |
206 | connect(lblGHI, SIGNAL(clearAll()), this, SLOT(clear())); | 208 | connect(lblGHI, SIGNAL(clearAll()), this, SLOT(clear())); |
207 | connect(lblJKL, SIGNAL(clearAll()), this, SLOT(clear())); | 209 | connect(lblJKL, SIGNAL(clearAll()), this, SLOT(clear())); |
208 | connect(lblMNO, SIGNAL(clearAll()), this, SLOT(clear())); | 210 | connect(lblMNO, SIGNAL(clearAll()), this, SLOT(clear())); |
209 | connect(lblPQR, SIGNAL(clearAll()), this, SLOT(clear())); | 211 | connect(lblPQR, SIGNAL(clearAll()), this, SLOT(clear())); |
210 | connect(lblSTU, SIGNAL(clearAll()), this, SLOT(clear())); | 212 | connect(lblSTU, SIGNAL(clearAll()), this, SLOT(clear())); |
211 | connect(lblVWX, SIGNAL(clearAll()), this, SLOT(clear())); | 213 | connect(lblVWX, SIGNAL(clearAll()), this, SLOT(clear())); |
212 | connect(lblYZ, SIGNAL(clearAll()), this, SLOT(clear())); | 214 | connect(lblYZ, SIGNAL(clearAll()), this, SLOT(clear())); |
213 | 215 | ||
214 | } | 216 | } |
215 | 217 | ||
216 | LetterPicker::~LetterPicker() | 218 | LetterPicker::~LetterPicker() |
217 | { | 219 | { |
218 | } | 220 | } |
219 | 221 | ||
220 | QSizePolicy LetterPicker::sizePolicy () const | 222 | QSizePolicy LetterPicker::sizePolicy () const |
221 | { | 223 | { |
222 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum); | 224 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum); |
223 | } | 225 | } |
224 | 226 | ||
225 | void LetterPicker::clear() | 227 | void LetterPicker::clear() |
226 | { | 228 | { |
227 | lblABC->clearLetter(); | 229 | lblABC->clearLetter(); |
228 | lblDEF->clearLetter(); | 230 | lblDEF->clearLetter(); |
229 | lblGHI->clearLetter(); | 231 | lblGHI->clearLetter(); |
230 | lblJKL->clearLetter(); | 232 | lblJKL->clearLetter(); |
231 | lblMNO->clearLetter(); | 233 | lblMNO->clearLetter(); |
232 | lblPQR->clearLetter(); | 234 | lblPQR->clearLetter(); |
233 | lblSTU->clearLetter(); | 235 | lblSTU->clearLetter(); |
234 | lblVWX->clearLetter(); | 236 | lblVWX->clearLetter(); |
235 | lblYZ->clearLetter(); | 237 | lblYZ->clearLetter(); |
236 | } | 238 | } |
237 | 239 | ||
238 | void LetterPicker::newLetter( char letter ) | 240 | void LetterPicker::newLetter( char letter ) |
239 | { | 241 | { |
240 | qWarning("LetterClicked"); | 242 | Opie::Core::owarn << "LetterClicked" << oendl; |
241 | emit letterClicked( letter ); | 243 | emit letterClicked( letter ); |
242 | 244 | ||
243 | } | 245 | } |