void PeopleApplication::createDetailPage(const QModelIndex &index) { if (m_detailPage) return; if (!index.isValid()) return; searchCancel(); m_currentIndex = index; m_currentPerson = new SeasidePerson(index); m_currentPerson->setViewType("personDetail"); connect(m_currentPerson, SIGNAL(callNumber(const QString&)), this, SLOT(callNumber(const QString&))); connect(m_currentPerson, SIGNAL(composeIM(const QString&)), this, SLOT(composeIM(const QString&))); connect(m_currentPerson, SIGNAL(composeSMS(const QString&)), this, SLOT(composeSMS(const QString&))); connect(m_currentPerson, SIGNAL(composeEmail(const QString&)), this, SLOT(composeEmail(const QString&))); connect(m_currentPerson, SIGNAL(viewRequest(qreal,qreal)), this, SLOT(scrollIntoView(qreal,qreal))); m_detailPage = new MApplicationPage; m_detailPage->setTitle(QObject::tr("Contact Detail","Title for detail view")); m_detailPage->setCentralWidget(m_currentPerson); MAction *action = new MAction(QObject::tr("<b>Edit</b>","Edit toolbar button to edit contact details"), this); action->setLocation(MAction::ApplicationMenuLocation); m_detailPage->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(editCurrent())); connect(m_detailPage, SIGNAL(backButtonClicked()), this, SLOT(detailBack())); m_detailPage->appear(MApplicationPage::DestroyWhenDismissed); }
/*! * \~english * Reimplemented QDataTable function. * \~russian * Переопределяет функцию QDataTable. Если контейнер wJournal, может испускаеть сигналы insertRequest(), updateRequest(), deleteRequest(), viewRequest() * \~ */ void wDBTable::contentsContextMenuEvent ( QContextMenuEvent * e ) { Q3Table::contentsContextMenuEvent( e ); QString str, ctype; if ( containerType() == "wDocument" || containerType() == "wCatalogue" ) { // Переопределяем всплывающее по правой кнопке мыши меню для табличной части документа // Во-первых, для его локализации // Во-вторых, чтобы добавляемая в табличную часть строка всегда вставлялась самой последней. enum { IdInsert=0, IdUpdate, IdDelete, }; QPointer<Q3PopupMenu> popupForDoc = new Q3PopupMenu( this ); int id[ 3 ]; id[ IdInsert ] = popupForDoc->insertItem( tr( "New" ) ); id[ IdUpdate ] = popupForDoc->insertItem( tr( "Edit" ) ); id[ IdDelete ] = popupForDoc->insertItem( tr( "Delete" ) ); if ( !sqlCursor() || isReadOnly() || !numCols() ) { popupForDoc->setItemEnabled(id[ IdInsert ], false ); popupForDoc->setItemEnabled(id[ IdUpdate ], false ); popupForDoc->setItemEnabled(id[ IdDelete ], false ); } int r = popupForDoc->exec( e->globalPos() ); delete (Q3PopupMenu*) popupForDoc; if(r==id[IdInsert]) { beginInsert(); } else if(r==id[IdUpdate]) { keyPressEvent( new QKeyEvent( QEvent::KeyPress, Qt::Key_F2, 0, Qt::NoButton)); } else if(r==id[IdDelete]) { Q3DataTable::deleteCurrent(); } } if ( containerType() == "wJournal" ) { //id = currentRecord()->value(0).toLongLong(); enum { IdInsert=0, IdUpdate, IdDelete, IdView, IdRefresh }; QPointer<Q3PopupMenu> popup = new Q3PopupMenu( this ); int id[ 5 ]; id[ IdInsert ] = popup->insertItem( tr( "New" ) ); id[ IdUpdate ] = popup->insertItem( tr( "Edit" ) ); id[ IdDelete ] = popup->insertItem( tr( "Delete" ) ); id[ IdView ] = popup->insertItem( tr( "View" ) ); id[ IdRefresh ] = popup->insertItem( tr( "Refresh" ) ); int r = popup->exec( e->globalPos() ); delete (Q3PopupMenu*) popup; if(r==id[IdInsert]) emit(insertRequest()); else if(r==id[IdUpdate]) emit(updateRequest()); else if(r==id[IdDelete]) emit(deleteRequest()); else if(r==id[IdView]) emit(viewRequest()); if(r==id[IdRefresh]) { //recalculate(); refresh(); } } e->accept(); }
void BasicContactViewer::sendViewRequest() const{emit viewRequest(user);}