352 setSearchActionEnabled(true); |
352 setSearchActionEnabled(true); |
353 #ifndef USE_SEARCH_BUTTON |
353 #ifndef USE_SEARCH_BUTTON |
354 tabChanged(1); |
354 tabChanged(1); |
355 #endif |
355 #endif |
356 |
356 |
357 if (contactList->currentItem()) { |
357 if ( |
|
358 #ifdef USE_CONTACTS_COMBOBOX |
|
359 contactList->currentIndex() != -1 |
|
360 #else |
|
361 contactList->currentItem() |
|
362 #endif |
|
363 ) { |
358 // Select the first address automatically |
364 // Select the first address automatically |
359 addressSelected(contactList->currentItem()->text()); |
365 addressSelected( |
|
366 #ifdef USE_CONTACTS_COMBOBOX |
|
367 contactList->currentText() |
|
368 #else |
|
369 contactList->currentItem()->text() |
|
370 #endif |
|
371 ); |
360 } |
372 } |
361 } |
373 } |
362 } |
374 } |
363 //! [continue-search] |
375 //! [continue-search] |
364 |
376 |
405 // Maemo 5 style doesn't take group box titles into account. |
417 // Maemo 5 style doesn't take group box titles into account. |
406 int spacingHack = QFontMetrics(QFont()).height(); |
418 int spacingHack = QFontMetrics(QFont()).height(); |
407 filterLayout->setContentsMargins(0, spacingHack, 0, 0); |
419 filterLayout->setContentsMargins(0, spacingHack, 0, 0); |
408 #endif |
420 #endif |
409 |
421 |
410 QLabel *includeLabel = new QLabel(tr("Contacted this")); |
422 QLabel *includeLabel = new QLabel(tr("Contacted in the last")); |
411 filterLayout->addWidget(includeLabel, 0, 0); |
423 filterLayout->addWidget(includeLabel, 0, 0); |
412 filterLayout->setAlignment(includeLabel, Qt::AlignRight); |
424 filterLayout->setAlignment(includeLabel, Qt::AlignRight); |
413 |
425 |
414 excludeCheckBox = new QCheckBox(tr("But not last")); |
426 excludeCheckBox = new QCheckBox(tr("But not in the last")); |
415 #ifdef Q_WS_MAEMO_5 |
427 #ifdef Q_WS_MAEMO_5 |
416 // Maemo 5 style cuts off check box text. |
428 // Maemo 5 style cuts off check box text. |
417 excludeCheckBox->setText(excludeCheckBox->text() + " "); |
429 excludeCheckBox->setText(excludeCheckBox->text() + " "); |
418 #endif |
430 #endif |
419 excludeCheckBox->setCheckState(Qt::Checked); |
|
420 connect(excludeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(excludePeriodEnabled(int))); |
431 connect(excludeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(excludePeriodEnabled(int))); |
421 filterLayout->addWidget(excludeCheckBox, 1, 0); |
432 filterLayout->addWidget(excludeCheckBox, 1, 0); |
422 filterLayout->setAlignment(excludeCheckBox, Qt::AlignRight); |
433 filterLayout->setAlignment(excludeCheckBox, Qt::AlignRight); |
423 |
434 |
424 includePeriod = new QComboBox; |
435 includePeriod = new QComboBox; |
433 filterLayout->addWidget(includePeriod, 0, 1); |
444 filterLayout->addWidget(includePeriod, 0, 1); |
434 |
445 |
435 excludePeriod = new QComboBox; |
446 excludePeriod = new QComboBox; |
436 excludePeriod->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
447 excludePeriod->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
437 filterLayout->addWidget(excludePeriod, 1, 1); |
448 filterLayout->addWidget(excludePeriod, 1, 1); |
|
449 excludePeriod->setEnabled(false); |
438 |
450 |
439 #ifdef USE_SEARCH_BUTTON |
451 #ifdef USE_SEARCH_BUTTON |
440 searchButton = new QPushButton(tr("Search")); |
452 searchButton = new QPushButton(tr("Search")); |
441 searchButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
453 searchButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
442 connect(searchButton, SIGNAL(clicked()), this, SLOT(searchMessages()), Qt::QueuedConnection); |
454 connect(searchButton, SIGNAL(clicked()), this, SLOT(searchMessages()), Qt::QueuedConnection); |
443 filterLayout->addWidget(searchButton, 2, 1); |
455 filterLayout->addWidget(searchButton, 2, 1); |
444 #endif |
456 #endif |
445 |
457 |
|
458 #ifdef USE_CONTACTS_COMBOBOX |
|
459 contactList = new QComboBox(this); |
|
460 connect(contactList, SIGNAL(currentIndexChanged(QString)), this, SLOT(addressSelected(QString))); |
|
461 #else |
446 contactList = new QListWidget(this); |
462 contactList = new QListWidget(this); |
447 connect(contactList, SIGNAL(currentTextChanged(QString)), this, SLOT(addressSelected(QString))); |
463 connect(contactList, SIGNAL(currentTextChanged(QString)), this, SLOT(addressSelected(QString))); |
|
464 #endif |
448 |
465 |
449 #ifndef USE_SEARCH_BUTTON |
466 #ifndef USE_SEARCH_BUTTON |
450 QWidget* resultsWidget = new QWidget(this); |
467 QWidget* resultsWidget = new QWidget(this); |
451 QVBoxLayout* resultsLayout = new QVBoxLayout(resultsWidget); |
468 QVBoxLayout* resultsLayout = new QVBoxLayout(resultsWidget); |
452 tabWidget->addTab(resultsWidget,"Results"); |
469 tabWidget->addTab(resultsWidget,"Results"); |
544 void AddressFinder::showMessage() |
561 void AddressFinder::showMessage() |
545 { |
562 { |
546 int index = messageCombo->currentIndex(); |
563 int index = messageCombo->currentIndex(); |
547 if (index != -1) { |
564 if (index != -1) { |
548 // Find the address currently selected |
565 // Find the address currently selected |
549 const QString &selectedAddress(addressList[contactList->currentRow()]); |
566 const QString &selectedAddress(addressList[ |
|
567 #ifdef USE_CONTACTS_COMBOBOX |
|
568 contactList->currentIndex() |
|
569 #else |
|
570 contactList->currentRow() |
|
571 #endif |
|
572 ]); |
550 |
573 |
551 // Show the message selected |
574 // Show the message selected |
552 QMessageId &messageId((addressMessages[selectedAddress])[index].second); |
575 QMessageId &messageId((addressMessages[selectedAddress])[index].second); |
553 service.show(messageId); |
576 service.show(messageId); |
554 } |
577 } |
559 void AddressFinder::forwardMessage() |
582 void AddressFinder::forwardMessage() |
560 { |
583 { |
561 int index = messageCombo->currentIndex(); |
584 int index = messageCombo->currentIndex(); |
562 if (index != -1) { |
585 if (index != -1) { |
563 // Find the address currently selected |
586 // Find the address currently selected |
564 const QString &selectedAddress(addressList[contactList->currentRow()]); |
587 const QString &selectedAddress(addressList[ |
|
588 #ifdef USE_CONTACTS_COMBOBOX |
|
589 contactList->currentIndex() |
|
590 #else |
|
591 contactList->currentRow() |
|
592 #endif |
|
593 ]); |
565 |
594 |
566 // Find the selected message |
595 // Find the selected message |
567 QMessageId &messageId((addressMessages[selectedAddress])[index].second); |
596 QMessageId &messageId((addressMessages[selectedAddress])[index].second); |
568 QMessage original(messageId); |
597 QMessage original(messageId); |
569 |
598 |