215 //! [create-date-range] |
215 //! [create-date-range] |
216 |
216 |
217 //! [create-simple-filters] |
217 //! [create-simple-filters] |
218 // We will include addresses contacted following the minimum date |
218 // We will include addresses contacted following the minimum date |
219 QMessageFilter includeFilter(QMessageFilter::byTimeStamp(minimumDate, QMessageDataComparator::GreaterThanEqual)); |
219 QMessageFilter includeFilter(QMessageFilter::byTimeStamp(minimumDate, QMessageDataComparator::GreaterThanEqual)); |
|
220 // Windows mobile only sets a receptionTimeStamp for sent messsages |
|
221 includeFilter |= QMessageFilter::byReceptionTimeStamp(minimumDate, QMessageDataComparator::GreaterThanEqual); |
220 |
222 |
221 QMessageFilter excludeFilter; |
223 QMessageFilter excludeFilter; |
222 if (useExclusionPeriod) { |
224 if (useExclusionPeriod) { |
223 // We will exclude addresses contacted following the maximum date |
225 // We will exclude addresses contacted following the maximum date |
224 excludeFilter = QMessageFilter::byTimeStamp(maximumDate, QMessageDataComparator::GreaterThanEqual); |
226 excludeFilter = QMessageFilter::byTimeStamp(maximumDate, QMessageDataComparator::GreaterThanEqual); |
|
227 excludeFilter |= QMessageFilter::byReceptionTimeStamp(maximumDate, QMessageDataComparator::GreaterThanEqual); |
225 } |
228 } |
226 //! [create-simple-filters] |
229 //! [create-simple-filters] |
227 |
|
228 // Not sure why reception timestamp is relevant to sent messages... |
|
229 includeFilter |= QMessageFilter::byReceptionTimeStamp(minimumDate, QMessageDataComparator::GreaterThanEqual); |
|
230 excludeFilter |= QMessageFilter::byReceptionTimeStamp(maximumDate, QMessageDataComparator::GreaterThanEqual); |
|
231 |
|
232 QMessageFilter exclusionFilter; |
|
233 |
230 |
234 //! [create-composite-filters] |
231 //! [create-composite-filters] |
235 // We only want to match messages that we sent |
232 // We only want to match messages that we sent |
236 QMessageFilter sentFilter(QMessageFilter::byStandardFolder(QMessage::SentFolder)); |
233 QMessageFilter sentFilter(QMessageFilter::byStandardFolder(QMessage::SentFolder)); |
237 |
234 |
238 // Create the filter needed to locate messages to search for addresses to include |
235 // Create the filter needed to locate messages to search for addresses to include |
239 inclusionFilter = (sentFilter & includeFilter & ~excludeFilter); |
236 if (useExclusionPeriod) { |
240 |
237 inclusionFilter = (sentFilter & includeFilter & ~excludeFilter); |
|
238 } else { |
|
239 inclusionFilter = (sentFilter & includeFilter); |
|
240 } |
|
241 //! [create-composite-filters] |
|
242 |
|
243 //! [begin-search] |
241 if (useExclusionPeriod) { |
244 if (useExclusionPeriod) { |
242 // Create the filter needed to locate messages whose address we will exclude |
245 // Create the filter needed to locate messages whose address we will exclude |
|
246 QMessageFilter exclusionFilter; |
243 exclusionFilter = (sentFilter & excludeFilter); |
247 exclusionFilter = (sentFilter & excludeFilter); |
244 } |
248 |
245 //! [create-composite-filters] |
|
246 |
|
247 //! [begin-search] |
|
248 if (useExclusionPeriod) { |
|
249 // Start the search for messages containing addresses to exclude |
249 // Start the search for messages containing addresses to exclude |
250 service.queryMessages(exclusionFilter); |
250 service.queryMessages(exclusionFilter); |
251 } else { |
251 } else { |
252 // Only search for messages containing addresses to include |
252 // Only search for messages containing addresses to include |
253 service.queryMessages(inclusionFilter); |
253 service.queryMessages(inclusionFilter); |
400 #else |
400 #else |
401 centralLayout->addWidget(inputGroup); |
401 centralLayout->addWidget(inputGroup); |
402 #endif |
402 #endif |
403 |
403 |
404 QGridLayout *filterLayout = new QGridLayout(inputGroup); |
404 QGridLayout *filterLayout = new QGridLayout(inputGroup); |
|
405 #ifdef Q_WS_MAEMO_5 |
|
406 // Maemo 5 style doesn't take group box titles into account. |
|
407 int spacingHack = QFontMetrics(QFont()).height(); |
|
408 filterLayout->setContentsMargins(0, spacingHack, 0, 0); |
|
409 #endif |
405 |
410 |
406 QLabel *includeLabel = new QLabel(tr("Contacted this")); |
411 QLabel *includeLabel = new QLabel(tr("Contacted this")); |
407 filterLayout->addWidget(includeLabel, 0, 0); |
412 filterLayout->addWidget(includeLabel, 0, 0); |
408 filterLayout->setAlignment(includeLabel, Qt::AlignRight); |
413 filterLayout->setAlignment(includeLabel, Qt::AlignRight); |
409 |
414 |
410 excludeCheckBox = new QCheckBox(tr("But not last")); |
415 excludeCheckBox = new QCheckBox(tr("But not last")); |
|
416 #ifdef Q_WS_MAEMO_5 |
|
417 // Maemo 5 style cuts off check box text. |
|
418 excludeCheckBox->setText(excludeCheckBox->text() + " "); |
|
419 #endif |
411 excludeCheckBox->setCheckState(Qt::Checked); |
420 excludeCheckBox->setCheckState(Qt::Checked); |
412 connect(excludeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(excludePeriodEnabled(int))); |
421 connect(excludeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(excludePeriodEnabled(int))); |
413 filterLayout->addWidget(excludeCheckBox, 1, 0); |
422 filterLayout->addWidget(excludeCheckBox, 1, 0); |
414 filterLayout->setAlignment(excludeCheckBox, Qt::AlignRight); |
423 filterLayout->setAlignment(excludeCheckBox, Qt::AlignRight); |
415 |
424 |
447 #endif |
456 #endif |
448 |
457 |
449 QGroupBox *addressGroup = new QGroupBox(tr("Contacts")); |
458 QGroupBox *addressGroup = new QGroupBox(tr("Contacts")); |
450 addressGroup->setAlignment(Qt::AlignLeft); |
459 addressGroup->setAlignment(Qt::AlignLeft); |
451 addressGroup->setLayout(new QVBoxLayout); |
460 addressGroup->setLayout(new QVBoxLayout); |
|
461 #ifdef Q_WS_MAEMO_5 |
|
462 addressGroup->layout()->setContentsMargins(0, spacingHack, 0, 0); |
|
463 #endif |
452 addressGroup->layout()->addWidget(contactList); |
464 addressGroup->layout()->addWidget(contactList); |
453 resultsLayout->addWidget(addressGroup); |
465 resultsLayout->addWidget(addressGroup); |
454 |
466 |
455 QGroupBox *messageGroup = new QGroupBox(tr("Messages")); |
467 QGroupBox *messageGroup = new QGroupBox(tr("Messages")); |
456 messageGroup->setAlignment(Qt::AlignLeft); |
468 messageGroup->setAlignment(Qt::AlignLeft); |
457 |
469 |
458 QVBoxLayout *groupLayout = new QVBoxLayout; |
470 QVBoxLayout *groupLayout = new QVBoxLayout; |
|
471 #ifdef Q_WS_MAEMO_5 |
|
472 groupLayout->setContentsMargins(0, spacingHack, 0, 0); |
|
473 #endif |
459 |
474 |
460 messageCombo = new QComboBox; |
475 messageCombo = new QComboBox; |
461 connect(messageCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(messageIndexChanged(int))); |
476 connect(messageCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(messageIndexChanged(int))); |
462 |
477 |
463 groupLayout->addWidget(messageCombo); |
478 groupLayout->addWidget(messageCombo); |