summaryrefslogtreecommitdiff
authoreilers <eilers>2003-09-29 07:48:22 (UTC)
committer eilers <eilers>2003-09-29 07:48:22 (UTC)
commit93b76e67cf954eab09091996a790301369d77a88 (patch) (unidiff)
tree07371fb611edaed9d4ef4cd5f0791657da579255
parent5e0dd8f6328bff965878c80b9d220a535b826376 (diff)
downloadopie-93b76e67cf954eab09091996a790301369d77a88.zip
opie-93b76e67cf954eab09091996a790301369d77a88.tar.gz
opie-93b76e67cf954eab09091996a790301369d77a88.tar.bz2
Now using default font instead smallsmooth
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/picker.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/pim/addressbook/picker.cpp b/core/pim/addressbook/picker.cpp
index 5099d68..9e0c78a 100644
--- a/core/pim/addressbook/picker.cpp
+++ b/core/pim/addressbook/picker.cpp
@@ -1,244 +1,245 @@
1#include "picker.h" 1#include "picker.h"
2 2
3#include <qfont.h> 3#include <qfont.h>
4#include <qstring.h> 4#include <qstring.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qlayout.h> 6#include <qlayout.h>
7 7
8char PickerLabel::lastLetter = '\0'; 8char PickerLabel::lastLetter = '\0';
9 9
10PickerLabel::PickerLabel( QWidget *parent, const char *name ) 10PickerLabel::PickerLabel( QWidget *parent, const char *name )
11 : QLabel ( parent, name ) 11 : QLabel ( parent, name )
12{ 12{
13 currentLetter = 0; 13 currentLetter = 0;
14 //lastLetter = 0; 14 //lastLetter = 0;
15 15
16 letter1 = '\0'; 16 letter1 = '\0';
17 letter2 = '\0'; 17 letter2 = '\0';
18 letter3 = '\0'; 18 letter3 = '\0';
19 19
20 setFont( QFont( "smallsmooth", 9 ) ); 20 // setFont( QFont( "smallsmooth", 9 ) );
21 setFont( QFont::defaultFont() );
21 setTextFormat( Qt::RichText ); 22 setTextFormat( Qt::RichText );
22 23
23} 24}
24 25
25PickerLabel::~PickerLabel() 26PickerLabel::~PickerLabel()
26{ 27{
27 28
28} 29}
29 30
30void PickerLabel::setLetters( char ch1, char ch2, char ch3 ) 31void PickerLabel::setLetters( char ch1, char ch2, char ch3 )
31{ 32{
32 QString tmpStr; 33 QString tmpStr;
33 34
34 if (ch1 != '\0') 35 if (ch1 != '\0')
35 letter1 = ch1; 36 letter1 = ch1;
36 else 37 else
37 letter1 = ' '; 38 letter1 = ' ';
38 39
39 if (ch2 != '\0') 40 if (ch2 != '\0')
40 letter2 = ch2; 41 letter2 = ch2;
41 else 42 else
42 letter2 = ' '; 43 letter2 = ' ';
43 44
44 if (ch3 != '\0') 45 if (ch3 != '\0')
45 letter3 = ch3; 46 letter3 = ch3;
46 else 47 else
47 letter3 = ' '; 48 letter3 = ' ';
48 49
49 tmpStr = "<qt>"; 50 tmpStr = "<qt>";
50 tmpStr += letter1; 51 tmpStr += letter1;
51 tmpStr += letter2; 52 tmpStr += letter2;
52 tmpStr += letter3; 53 tmpStr += letter3;
53 tmpStr += "</qt>"; 54 tmpStr += "</qt>";
54 55
55 setText(tmpStr); 56 setText(tmpStr);
56 57
57 currentLetter = 0; 58 currentLetter = 0;
58 59
59} 60}
60 61
61void PickerLabel::clearLetter() 62void PickerLabel::clearLetter()
62{ 63{
63 64
64 QString tmpStr; 65 QString tmpStr;
65 66
66 tmpStr = "<qt>"; 67 tmpStr = "<qt>";
67 tmpStr += letter1; 68 tmpStr += letter1;
68 tmpStr += letter2; 69 tmpStr += letter2;
69 tmpStr += letter3; 70 tmpStr += letter3;
70 tmpStr += "</qt>"; 71 tmpStr += "</qt>";
71 72
72 setText(tmpStr); 73 setText(tmpStr);
73 74
74 currentLetter = 0; 75 currentLetter = 0;
75 76
76} 77}
77 78
78void PickerLabel::mousePressEvent( QMouseEvent* e ) 79void PickerLabel::mousePressEvent( QMouseEvent* e )
79{ 80{
80 // 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
81 // have to simulate the releaseevent.. Otherwise the new label 82 // have to simulate the releaseevent.. Otherwise the new label
82 // will not get a highlighted letter.. 83 // will not get a highlighted letter..
83 // 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)
84 if ( ( currentLetter == 0 ) && ( lastLetter != '\0' ) ) mouseReleaseEvent( e ); 85 if ( ( currentLetter == 0 ) && ( lastLetter != '\0' ) ) mouseReleaseEvent( e );
85} 86}
86 87
87void PickerLabel::mouseReleaseEvent( QMouseEvent* /* e */ ) 88void PickerLabel::mouseReleaseEvent( QMouseEvent* /* e */ )
88{ 89{
89 QString tmpStr; 90 QString tmpStr;
90 91
91 if (lastLetter != letter1 && lastLetter != letter2 && lastLetter != letter3 && lastLetter != '\0') 92 if (lastLetter != letter1 && lastLetter != letter2 && lastLetter != letter3 && lastLetter != '\0')
92 QTimer::singleShot( 0, this, SLOT(emitClearSignal()) ); 93 QTimer::singleShot( 0, this, SLOT(emitClearSignal()) );
93 94
94 switch (currentLetter) { 95 switch (currentLetter) {
95 case 0: 96 case 0:
96 tmpStr = "<qt><u><b><font color=\"#FF00FF\">"; 97 tmpStr = "<qt><u><b><font color=\"#FF00FF\">";
97 tmpStr += letter1; 98 tmpStr += letter1;
98 tmpStr += "</font></b></u>"; 99 tmpStr += "</font></b></u>";
99 tmpStr += letter2; 100 tmpStr += letter2;
100 tmpStr += letter3; 101 tmpStr += letter3;
101 tmpStr += "</qt>"; 102 tmpStr += "</qt>";
102 103
103 setText(tmpStr); 104 setText(tmpStr);
104 105
105 currentLetter++; 106 currentLetter++;
106 lastLetter = letter1; 107 lastLetter = letter1;
107 emit selectedLetter( letter1 ); 108 emit selectedLetter( letter1 );
108 break; 109 break;
109 110
110 case 1: 111 case 1:
111 tmpStr = "<qt>"; 112 tmpStr = "<qt>";
112 tmpStr += letter1; 113 tmpStr += letter1;
113 tmpStr += "<u><b><font color=\"#FF00FF\">"; 114 tmpStr += "<u><b><font color=\"#FF00FF\">";
114 tmpStr += letter2; 115 tmpStr += letter2;
115 tmpStr += "</font></b></u>"; 116 tmpStr += "</font></b></u>";
116 tmpStr += letter3; 117 tmpStr += letter3;
117 tmpStr += "</qt>"; 118 tmpStr += "</qt>";
118 119
119 setText(tmpStr); 120 setText(tmpStr);
120 121
121 currentLetter++; 122 currentLetter++;
122 lastLetter = letter2; 123 lastLetter = letter2;
123 emit selectedLetter( letter2 ); 124 emit selectedLetter( letter2 );
124 break; 125 break;
125 126
126 case 2: 127 case 2:
127 tmpStr = "<qt>"; 128 tmpStr = "<qt>";
128 tmpStr += letter1; 129 tmpStr += letter1;
129 tmpStr += letter2; 130 tmpStr += letter2;
130 tmpStr += "<u><b><font color=\"#FF00FF\">"; 131 tmpStr += "<u><b><font color=\"#FF00FF\">";
131 tmpStr += letter3; 132 tmpStr += letter3;
132 tmpStr += "</font></b></u></qt>"; 133 tmpStr += "</font></b></u></qt>";
133 134
134 setText(tmpStr); 135 setText(tmpStr);
135 136
136 currentLetter++; 137 currentLetter++;
137 lastLetter = letter3; 138 lastLetter = letter3;
138 emit selectedLetter( letter3 ); 139 emit selectedLetter( letter3 );
139 break; 140 break;
140 141
141 default: 142 default:
142 clearLetter(); 143 clearLetter();
143 lastLetter = '\0'; 144 lastLetter = '\0';
144 emit selectedLetter( '\0' ); 145 emit selectedLetter( '\0' );
145 146
146 147
147 } 148 }
148} 149}
149 150
150void PickerLabel::emitClearSignal() { 151void PickerLabel::emitClearSignal() {
151 emit clearAll(); 152 emit clearAll();
152} 153}
153 154
154LetterPicker::LetterPicker( QWidget *parent, const char *name ) 155LetterPicker::LetterPicker( QWidget *parent, const char *name )
155 : QFrame( parent, name ) 156 : QFrame( parent, name )
156{ 157{
157 QHBoxLayout *l = new QHBoxLayout(this); 158 QHBoxLayout *l = new QHBoxLayout(this);
158 159
159 lblABC = new PickerLabel( this ); 160 lblABC = new PickerLabel( this );
160 l->addWidget( lblABC ); 161 l->addWidget( lblABC );
161 162
162 lblDEF = new PickerLabel( this ); 163 lblDEF = new PickerLabel( this );
163 l->addWidget( lblDEF ); 164 l->addWidget( lblDEF );
164 165
165 lblGHI = new PickerLabel( this ); 166 lblGHI = new PickerLabel( this );
166 l->addWidget( lblGHI ); 167 l->addWidget( lblGHI );
167 168
168 lblJKL = new PickerLabel( this ); 169 lblJKL = new PickerLabel( this );
169 l->addWidget( lblJKL ); 170 l->addWidget( lblJKL );
170 171
171 lblMNO = new PickerLabel( this ); 172 lblMNO = new PickerLabel( this );
172 l->addWidget( lblMNO ); 173 l->addWidget( lblMNO );
173 174
174 lblPQR = new PickerLabel( this ); 175 lblPQR = new PickerLabel( this );
175 l->addWidget( lblPQR ); 176 l->addWidget( lblPQR );
176 177
177 lblSTU = new PickerLabel( this ); 178 lblSTU = new PickerLabel( this );
178 l->addWidget( lblSTU ); 179 l->addWidget( lblSTU );
179 180
180 lblVWX = new PickerLabel( this ); 181 lblVWX = new PickerLabel( this );
181 l->addWidget( lblVWX ); 182 l->addWidget( lblVWX );
182 183
183 lblYZ = new PickerLabel( this ); 184 lblYZ = new PickerLabel( this );
184 l->addWidget( lblYZ ); 185 l->addWidget( lblYZ );
185 186
186 lblABC->setLetters( 'A', 'B', 'C' ); 187 lblABC->setLetters( 'A', 'B', 'C' );
187 lblDEF->setLetters( 'D', 'E', 'F' ); 188 lblDEF->setLetters( 'D', 'E', 'F' );
188 lblGHI->setLetters( 'G', 'H', 'I' ); 189 lblGHI->setLetters( 'G', 'H', 'I' );
189 lblJKL->setLetters( 'J', 'K', 'L' ); 190 lblJKL->setLetters( 'J', 'K', 'L' );
190 lblMNO->setLetters( 'M', 'N', 'O' ); 191 lblMNO->setLetters( 'M', 'N', 'O' );
191 lblPQR->setLetters( 'P', 'Q', 'R' ); 192 lblPQR->setLetters( 'P', 'Q', 'R' );
192 lblSTU->setLetters( 'S', 'T', 'U' ); 193 lblSTU->setLetters( 'S', 'T', 'U' );
193 lblVWX->setLetters( 'V', 'W', 'X' ); 194 lblVWX->setLetters( 'V', 'W', 'X' );
194 lblYZ->setLetters( 'Y', 'Z', '#' ); 195 lblYZ->setLetters( 'Y', 'Z', '#' );
195 196
196 connect(lblABC, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); 197 connect(lblABC, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char)));
197 connect(lblDEF, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); 198 connect(lblDEF, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char)));
198 connect(lblGHI, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); 199 connect(lblGHI, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char)));
199 connect(lblJKL, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); 200 connect(lblJKL, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char)));
200 connect(lblMNO, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); 201 connect(lblMNO, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char)));
201 connect(lblPQR, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); 202 connect(lblPQR, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char)));
202 connect(lblSTU, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); 203 connect(lblSTU, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char)));
203 connect(lblVWX, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); 204 connect(lblVWX, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char)));
204 connect(lblYZ, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); 205 connect(lblYZ, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char)));
205 connect(lblABC, SIGNAL(clearAll()), this, SLOT(clear())); 206 connect(lblABC, SIGNAL(clearAll()), this, SLOT(clear()));
206 connect(lblDEF, SIGNAL(clearAll()), this, SLOT(clear())); 207 connect(lblDEF, SIGNAL(clearAll()), this, SLOT(clear()));
207 connect(lblGHI, SIGNAL(clearAll()), this, SLOT(clear())); 208 connect(lblGHI, SIGNAL(clearAll()), this, SLOT(clear()));
208 connect(lblJKL, SIGNAL(clearAll()), this, SLOT(clear())); 209 connect(lblJKL, SIGNAL(clearAll()), this, SLOT(clear()));
209 connect(lblMNO, SIGNAL(clearAll()), this, SLOT(clear())); 210 connect(lblMNO, SIGNAL(clearAll()), this, SLOT(clear()));
210 connect(lblPQR, SIGNAL(clearAll()), this, SLOT(clear())); 211 connect(lblPQR, SIGNAL(clearAll()), this, SLOT(clear()));
211 connect(lblSTU, SIGNAL(clearAll()), this, SLOT(clear())); 212 connect(lblSTU, SIGNAL(clearAll()), this, SLOT(clear()));
212 connect(lblVWX, SIGNAL(clearAll()), this, SLOT(clear())); 213 connect(lblVWX, SIGNAL(clearAll()), this, SLOT(clear()));
213 connect(lblYZ, SIGNAL(clearAll()), this, SLOT(clear())); 214 connect(lblYZ, SIGNAL(clearAll()), this, SLOT(clear()));
214 215
215} 216}
216 217
217LetterPicker::~LetterPicker() 218LetterPicker::~LetterPicker()
218{ 219{
219} 220}
220 221
221QSizePolicy LetterPicker::sizePolicy () const 222QSizePolicy LetterPicker::sizePolicy () const
222{ 223{
223 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum); 224 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum);
224} 225}
225 226
226void LetterPicker::clear() 227void LetterPicker::clear()
227{ 228{
228 lblABC->clearLetter(); 229 lblABC->clearLetter();
229 lblDEF->clearLetter(); 230 lblDEF->clearLetter();
230 lblGHI->clearLetter(); 231 lblGHI->clearLetter();
231 lblJKL->clearLetter(); 232 lblJKL->clearLetter();
232 lblMNO->clearLetter(); 233 lblMNO->clearLetter();
233 lblPQR->clearLetter(); 234 lblPQR->clearLetter();
234 lblSTU->clearLetter(); 235 lblSTU->clearLetter();
235 lblVWX->clearLetter(); 236 lblVWX->clearLetter();
236 lblYZ->clearLetter(); 237 lblYZ->clearLetter();
237} 238}
238 239
239void LetterPicker::newLetter( char letter ) 240void LetterPicker::newLetter( char letter )
240{ 241{
241 qWarning("LetterClicked"); 242 qWarning("LetterClicked");
242 emit letterClicked( letter ); 243 emit letterClicked( letter );
243 244
244} 245}