| 329 | #define WIZACTION_LIST_MESSAGE_LOCATE QObject::tr("Locate Message") |
| 330 | |
| 331 | WizMessageListView::WizMessageListView(WizDatabaseManager& dbMgr, QWidget *parent) |
| 332 | : QListWidget(parent) |
| 333 | , m_dbMgr(dbMgr) |
| 334 | , m_pCurrentItem(NULL) |
| 335 | , m_api(NULL) |
| 336 | { |
| 337 | setFrameStyle(QFrame::NoFrame); |
| 338 | setAttribute(Qt::WA_MacShowFocusRect, false); |
| 339 | setSelectionMode(QAbstractItemView::ExtendedSelection); |
| 340 | setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
| 341 | |
| 342 | QString strSkinName = "default"; // FIXME |
| 343 | setStyle(::WizGetStyle(strSkinName)); |
| 344 | QPalette pal = palette(); |
| 345 | pal.setColor(QPalette::Base, Utils::WizStyleHelper::listViewBackground()); |
| 346 | setPalette(pal); |
| 347 | |
| 348 | setCursor(QCursor(Qt::ArrowCursor)); |
| 349 | |
| 350 | setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); |
| 351 | #ifdef Q_OS_MAC |
| 352 | verticalScrollBar()->setSingleStep(15); |
| 353 | #else |
| 354 | verticalScrollBar()->setSingleStep(30); |
| 355 | #endif |
| 356 | |
| 357 | #ifdef WIZNOTE_CUSTOM_SCROLLBAR |
| 358 | setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
| 359 | setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
| 360 | m_vScroll = new WizScrollBar(this); |
| 361 | m_vScroll->syncWith(verticalScrollBar()); |
| 362 | #endif |
| 363 | |
| 364 | // init |
| 365 | m_timerRead.setInterval(100); |
| 366 | m_timerRead.setSingleShot(true); |
| 367 | connect(&m_timerRead, SIGNAL(timeout()), SLOT(onReadTimeout())); |
| 368 | |
| 369 | m_timerTriggerSync.setInterval(5000); |
| 370 | m_timerTriggerSync.setSingleShot(true); |
| 371 | connect(&m_timerTriggerSync, SIGNAL(timeout()), SLOT(onSyncTimeout())); |
| 372 | |
| 373 | m_menu = new QMenu(this); |
| 374 | m_menu->addAction(WIZACTION_LIST_MESSAGE_MARK_READ, this, |
| 375 | SLOT(on_action_message_mark_read())); |
| 376 | m_menu->addAction(WIZACTION_LIST_MESSAGE_LOCATE, this, |
| 377 | SLOT(on_action_message_locate())); |
| 378 | m_menu->addAction(tr("View in Separate Window"), this, |
| 379 | SLOT(on_action_message_viewInSeparateWindow())); |
| 380 | m_menu->addSeparator(); |
| 381 | m_menu->addAction(WIZACTION_LIST_MESSAGE_DELETE, this, |
| 382 | SLOT(on_action_message_delete())); |
| 383 | |
| 384 | connect(m_menu, SIGNAL(aboutToHide()), SLOT(clearRightMenuFocus())); |
| 385 | |
| 386 | connect(this, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), |
| 387 | SLOT(onCurrentItemChanged(QListWidgetItem*,QListWidgetItem*))); |
| 388 |
nothing calls this directly
no test coverage detected