Diffstat (limited to 'core/pim/addressbook/picker.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/picker.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/core/pim/addressbook/picker.cpp b/core/pim/addressbook/picker.cpp index a165451..7f4acb0 100644 --- a/core/pim/addressbook/picker.cpp +++ b/core/pim/addressbook/picker.cpp @@ -54,94 +54,103 @@ void PickerLabel::setLetters( char ch1, char ch2, char ch3 ) setText(tmpStr); currentLetter = 0; } void PickerLabel::clearLetter() { QString tmpStr; tmpStr = "<qt>"; tmpStr += letter1; tmpStr += letter2; tmpStr += letter3; tmpStr += "</qt>"; setText(tmpStr); currentLetter = 0; } -void PickerLabel::mouseReleaseEvent( QMouseEvent *e ) +void PickerLabel::mousePressEvent( QMouseEvent* e ) +{ + // If one pickerlabel is was, and an other is now selected, we + // have to simulate the releaseevent.. Otherwise the new label + // will not get a highlighted letter.. + // Maybe there is a more intelligent solution, but this works and I am tired.. (se) + if ( ( currentLetter == 0 ) && ( lastLetter != '\0' ) ) mouseReleaseEvent( e ); +} + +void PickerLabel::mouseReleaseEvent( QMouseEvent* /* e */ ) { QString tmpStr; if (lastLetter != letter1 && lastLetter != letter2 && lastLetter != letter3 && lastLetter != '\0') QTimer::singleShot( 0, this, SLOT(emitClearSignal()) ); switch (currentLetter) { case 0: - tmpStr = "<qt><font color=\"#7F0000\">"; + tmpStr = "<qt><u><font color=\"#7F0000\">"; tmpStr += letter1; - tmpStr += "</font>"; + tmpStr += "</font></u>"; tmpStr += letter2; tmpStr += letter3; tmpStr += "</qt>"; setText(tmpStr); currentLetter++; lastLetter = letter1; emit selectedLetter( letter1 ); break; case 1: tmpStr = "<qt>"; tmpStr += letter1; - tmpStr += "<font color=\"#7F0000\">"; + tmpStr += "<u><font color=\"#7F0000\">"; tmpStr += letter2; - tmpStr += "</font>"; + tmpStr += "</font></u>"; tmpStr += letter3; tmpStr += "</qt>"; setText(tmpStr); currentLetter++; lastLetter = letter2; emit selectedLetter( letter2 ); break; case 2: tmpStr = "<qt>"; tmpStr += letter1; tmpStr += letter2; - tmpStr += "<font color=\"#7F0000\">"; + tmpStr += "<u><font color=\"#7F0000\">"; tmpStr += letter3; - tmpStr += "</font></qt>"; + tmpStr += "</font></u></qt>"; setText(tmpStr); currentLetter++; lastLetter = letter3; emit selectedLetter( letter3 ); break; default: clearLetter(); lastLetter = '\0'; emit selectedLetter( '\0' ); } } void PickerLabel::emitClearSignal() { emit clearAll(); } LetterPicker::LetterPicker( QWidget *parent, const char *name ) : QFrame( parent, name ) { @@ -203,27 +212,28 @@ LetterPicker::LetterPicker( QWidget *parent, const char *name ) connect(lblVWX, SIGNAL(clearAll()), this, SLOT(clear())); connect(lblYZ, SIGNAL(clearAll()), this, SLOT(clear())); } LetterPicker::~LetterPicker() { } void LetterPicker::clear() { lblABC->clearLetter(); lblDEF->clearLetter(); lblGHI->clearLetter(); lblJKL->clearLetter(); lblMNO->clearLetter(); lblPQR->clearLetter(); lblSTU->clearLetter(); lblVWX->clearLetter(); lblYZ->clearLetter(); } void LetterPicker::newLetter( char letter ) { + qWarning("LetterClicked"); emit letterClicked( letter ); } |