summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/abtable.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/addressbook/abtable.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 00335ae..aec390d 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -117,56 +117,56 @@ void AbPickItem::setContentFromEditor( QWidget *w )
\brief QTable based class for showing a list of entries
*/
AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name )
: QTable( parent, name ),
lastSortCol( -1 ),
asc( TRUE ),
intFields( order ),
enablePainting( true ),
columnVisible( true ),
countNested( 0 )
{
- qWarning("C'tor start");
+ // qWarning("C'tor start");
setSelectionMode( NoSelection );
init();
setSorting( TRUE );
connect( this, SIGNAL(clicked(int,int,int,const QPoint &)),
this, SLOT(itemClicked(int,int)) );
contactList.clear();
- qWarning("C'tor end");
+ // qWarning("C'tor end");
}
AbTable::~AbTable()
{
}
void AbTable::init()
{
// :SX showChar = '\0';
setNumRows( 0 );
setNumCols( 2 );
horizontalHeader()->setLabel( 0, tr( "Full Name" ));
horizontalHeader()->setLabel( 1, tr( "Contact" ));
setLeftMargin( 0 );
verticalHeader()->hide();
columnVisible = true;
}
void AbTable::setContacts( const OContactAccess::List& viewList )
{
- qWarning("AbTable::setContacts()");
+ // qWarning("AbTable::setContacts()");
clear();
m_viewList = viewList;
setSorting( false );
setPaintingEnabled( FALSE );
OContactAccess::List::Iterator it;
setNumRows( m_viewList.count() );
int row = 0;
for ( it = m_viewList.begin(); it != m_viewList.end(); ++it )
insertIntoTable( *it, row++ );
@@ -174,25 +174,25 @@ void AbTable::setContacts( const OContactAccess::List& viewList )
setSorting( true );
resort();
updateVisible();
setPaintingEnabled( TRUE );
}
bool AbTable::selectContact( int UID )
{
- qWarning( "AbTable::selectContact( %d )", UID );
+ // qWarning( "AbTable::selectContact( %d )", UID );
int rows = numRows();
AbTableItem *abi;
OContact* foundContact = 0l;
bool found = false;
setPaintingEnabled( FALSE );
for ( int r = 0; r < rows; ++r ) {
abi = static_cast<AbTableItem*>( item(r, 0) );
foundContact = &contactList[abi];
if ( foundContact -> uid() == UID ){
ensureCellVisible( r, 0 );
setCurrentCell( r, 0 );
@@ -204,25 +204,25 @@ bool AbTable::selectContact( int UID )
if ( !found ){
ensureCellVisible( 0,0 );
setCurrentCell( 0, 0 );
}
setPaintingEnabled( TRUE );
return true;
}
void AbTable::insertIntoTable( const OContact& cnt, int row )
{
- qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row );
+ // qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row );
QString strName,
strContact;
strName = findContactName( cnt );
strContact = findContactContact( cnt, row );
AbTableItem *ati;
ati = new AbTableItem( this, QTableItem::Never, strName, strContact);
contactList.insert( ati, cnt );
setItem( row, 0, ati );
ati = new AbTableItem( this, QTableItem::Never, strContact, strName);
setItem( row, 1, ati );
@@ -245,97 +245,97 @@ void AbTable::columnClicked( int col )
if ( col == lastSortCol ) {
asc = !asc;
} else {
lastSortCol = col;
asc = TRUE;
}
//QMessageBox::information( this, "resort", "columnClicked" );
resort();
}
void AbTable::resort()
{
- qWarning( "void AbTable::resort()" );
+ // qWarning( "void AbTable::resort()" );
setPaintingEnabled( FALSE );
if ( sorting() ) {
if ( lastSortCol == -1 )
lastSortCol = 0;
sortColumn( lastSortCol, asc, TRUE );
//QMessageBox::information( this, "resort", "resort" );
updateVisible();
}
setPaintingEnabled( TRUE );
}
OContact AbTable::currentEntry()
{
- qWarning( "OContact AbTable::currentEntry()" );
+ // qWarning( "OContact AbTable::currentEntry()" );
OContact cnt;
AbTableItem *abItem;
abItem = static_cast<AbTableItem*>(item( currentRow(), 0 ));
if ( abItem ) {
cnt = contactList[abItem];
//cnt = contactList[currentRow()];
}
return cnt;
}
int AbTable::currentEntry_UID()
{
return ( currentEntry().uid() );
}
void AbTable::clear()
{
- qWarning( "void AbTable::clear()" );
+ // qWarning( "void AbTable::clear()" );
contactList.clear();
setPaintingEnabled( FALSE );
for ( int r = 0; r < numRows(); ++r ) {
for ( int c = 0; c < numCols(); ++c ) {
if ( cellWidget( r, c ) )
clearCellWidget( r, c );
clearCell( r, c );
}
}
setNumRows( 0 );
setPaintingEnabled( TRUE );
}
// Refresh updates column 2 if the contactsettings changed
void AbTable::refresh()
{
- qWarning( "void AbTable::refresh()" );
+ // qWarning( "void AbTable::refresh()" );
int rows = numRows();
QString value;
AbTableItem *abi;
setPaintingEnabled( FALSE );
for ( int r = 0; r < rows; ++r ) {
abi = static_cast<AbTableItem*>( item(r, 0) );
value = findContactContact( contactList[abi], r );
static_cast<AbTableItem*>( item(r, 1) )->setItem( value, abi->text() );
}
resort();
setPaintingEnabled( TRUE );
}
void AbTable::keyPressEvent( QKeyEvent *e )
{
char key = toupper( e->ascii() );
if ( key >= 'A' && key <= 'Z' )
moveTo( key );
- qWarning("Received key ..");
+ // qWarning("Received key ..");
switch( e->key() ) {
case Qt::Key_Space:
case Qt::Key_Return:
case Qt::Key_Enter:
emit signalSwitch();
break;
// case Qt::Key_Up:
// qWarning("a");
// emit signalKeyUp();
// break;
// case Qt::Key_Down:
// qWarning("b");
@@ -402,25 +402,25 @@ void AbTable::resizeRows() {
if (numRows()) {
for (int i = 0; i < numRows(); i++) {
setRowHeight( i, size );
}
}
updateVisible();
*/
}
void AbTable::realignTable()
{
- qWarning( "void AbTable::realignTable()" );
+ // qWarning( "void AbTable::realignTable()" );
setPaintingEnabled( FALSE );
resizeRows();
fitColumns();
setPaintingEnabled( TRUE );
}
@@ -452,75 +452,75 @@ void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch )
// return 18*row;
// }
// int AbTable::rowAt( int pos ) const
// {
// return QMIN( pos/18, numRows()-1 );
// }
void AbTable::fitColumns()
{
- qWarning( "void AbTable::fitColumns()" );
+ // qWarning( "void AbTable::fitColumns()" );
int contentsWidth = visibleWidth() / 2; // :SX Why too low
// Fix to better value
// contentsWidth = 130;
setPaintingEnabled( FALSE );
if ( columnVisible == false ){
showColumn(0);
columnVisible = true;
}
- qWarning("Width: %d", contentsWidth);
+ // qWarning("Width: %d", contentsWidth);
setColumnWidth( 0, contentsWidth );
adjustColumn(1);
if ( columnWidth(1) < contentsWidth )
setColumnWidth( 1, contentsWidth );
setPaintingEnabled( TRUE );
}
void AbTable::show()
{
- qWarning( "void AbTable::show()" );
+ // qWarning( "void AbTable::show()" );
realignTable();
QTable::show();
}
void AbTable::setChoiceNames( const QStringList& list)
{
choicenames = list;
if ( choicenames.isEmpty() ) {
// hide pick column
setNumCols( 2 );
} else {
// show pick column
setNumCols( 3 );
setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 );
horizontalHeader()->setLabel( 2, tr( "Pick" ));
}
fitColumns();
}
void AbTable::itemClicked(int,int col)
{
- qWarning( "AbTable::itemClicked(int, col:%d)", col);
+ // qWarning( "AbTable::itemClicked(int, col:%d)", col);
if ( col == 2 ) {
return;
} else {
- qWarning ("Emitting signalSwitch()");
+ // qWarning ("Emitting signalSwitch()");
emit signalSwitch();
}
}
QStringList AbTable::choiceNames() const
{
return choicenames;
}
void AbTable::setChoiceSelection( const QValueList<int>& list )
{
intFields = list;
@@ -539,25 +539,25 @@ QStringList AbTable::choiceSelection(int /*index*/) const
}
}
*/
return r;
}
void AbTable::updateVisible()
{
- qWarning("void AbTable::updateVisible()");
+ // qWarning("void AbTable::updateVisible()");
int visible,
totalRows,
row,
selectedRow = 0;
visible = 0;
setPaintingEnabled( FALSE );
realignTable();
@@ -577,45 +577,45 @@ void AbTable::updateVisible()
if ( !visible )
setCurrentCell( -1, 0 );
setPaintingEnabled( TRUE );
}
void AbTable::setPaintingEnabled( bool e )
{
- qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested );
+ // qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested );
if ( e ) {
if ( countNested > 0 )
--countNested;
if ( ! countNested ){
setUpdatesEnabled( true );
enablePainting = true;
rowHeightChanged( 0 );
viewport()->update();
}
} else {
++countNested;
enablePainting = false;
setUpdatesEnabled( false );
}
- qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested );
+ // qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested );
}
void AbTable::viewportPaintEvent( QPaintEvent* e ) {
- qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting);
+ // qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting);
if ( enablePainting )
QTable::viewportPaintEvent( e );
}
void AbTable::rowHeightChanged( int row )
{
if ( enablePainting )
QTable::rowHeightChanged( row );
}
QString AbTable::findContactContact( const OContact &entry, int /* row */ )