00001 /**************************************************************************** 00002 ** ui.h extension file, included from the uic-generated form implementation. 00003 ** 00004 ** If you wish to add, delete or rename functions or slots use 00005 ** Qt Designer which will update this file, preserving your code. Create an 00006 ** init() function in place of a constructor, and a destroy() function in 00007 ** place of a destructor. 00008 *****************************************************************************/ 00009 00010 void QlabContactManager::init() 00011 { 00012 dataViewTable->setLeftMargin( 0 ) ; 00013 dataViewTable->refresh( QDataTable::RefreshAll ) ; 00014 ctrl = new QSqlCursor( "Contacts", TRUE ) ; 00015 searchFields << "contact_qa" << "contact_name" ; 00016 } 00017 00018 void QlabContactManager::searchIt( const QString & srch ) 00019 { 00020 QString arg2 = "" ; 00021 for ( QStringList::Iterator it = searchFields.begin(); it != searchFields.end(); ++it ) { 00022 arg2.append( QString( " AND %1 LIKE '%2'" ).arg( *it ).arg( srch ) ) ; 00023 dataViewTable->setFilter( QString( "%1%2" ) 00024 .arg( defType ).arg( arg2 ) ) ; 00025 dataViewTable->refresh() ; 00026 } 00027 } 00028 00029 00030 void QlabContactManager::selectionChanged( QSqlRecord * buffer ) 00031 { 00032 ctrl->setFilter( QString( "recid='%1'" ).arg( buffer->value( "recid" ).toInt() ) ) ; 00033 ctrl->select() ; 00034 ctrl->next() ; 00035 emit refererChanged( ctrl ) ; 00036 } 00037 00038 00039 QString QlabContactManager::defaultFilter() const 00040 { 00041 return defType ; 00042 } 00043 00044 00045 void QlabContactManager::setDefaultFilter( const QString & defFlt ) 00046 { 00047 defType = defFlt ; 00048 resetSearch() ; 00049 } 00050 00051 00052 void QlabContactManager::resetSearch() 00053 { 00054 dataViewTable->setFilter( defType ) ; 00055 dataViewTable->refresh() ; 00056 }