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.cpp57
1 files changed, 30 insertions, 27 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index cd77b13..cb57342 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -10,25 +10,25 @@
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-
+#include <opie2/odebug.h>
#include <opie2/opimrecordlist.h>
#include <qpe/timestring.h>
#include <qpe/resource.h>
#include "abtable.h"
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
@@ -112,56 +112,55 @@ 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");
-
+ // Opie::Core::owarn << "C'tor start" << oendl;
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");
+ // Opie::Core::owarn << "C'tor end" << oendl;
}
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 Opie::OPimContactAccess::List& viewList )
{
- qWarning("AbTable::setContacts()");
+ Opie::Core::owarn << "AbTable::setContacts()" << oendl;
clear();
m_viewList = viewList;
setSorting( false );
setPaintingEnabled( FALSE );
Opie::OPimContactAccess::List::Iterator it;
setNumRows( m_viewList.count() );
// int row = 0;
// for ( it = m_viewList.begin(); it != m_viewList.end(); ++it )
// insertIntoTable( *it, row++ );
@@ -175,55 +174,56 @@ void AbTable::setContacts( const Opie::OPimContactAccess::List& viewList )
setPaintingEnabled( TRUE );
}
void AbTable::setOrderedList( const QValueList<int> ordered )
{
intFields = ordered;
}
bool AbTable::selectContact( int UID )
{
- qWarning( "AbTable::selectContact( %d )", UID );
+ Opie::Core::owarn << "AbTable::selectContact( " << UID << " )" << oendl;
int rows = numRows();
Opie::OPimContact* foundContact = 0l;
bool found = false;
setPaintingEnabled( FALSE );
- qWarning( "search start" );
+ Opie::Core::owarn << "Search start" << oendl;
for ( int r = 0; r < rows; ++r ) {
if ( m_viewList.uidAt( r ) == UID ){
ensureCellVisible( r, 0 );
setCurrentCell( r, 0 );
found = true;
break;
}
}
- qWarning( "search end" );
+ Opie::Core::owarn << "Search end" << oendl;
if ( !found ){
ensureCellVisible( 0,0 );
setCurrentCell( 0, 0 );
}
setPaintingEnabled( TRUE );
return true;
}
#if 0
void AbTable::insertIntoTable( const Opie::OPimContact& cnt, int row )
{
- qWarning( "void AbTable::insertIntoTable( const Opie::OPimContact& cnt, %d )", row );
+ Opie::Core::owarn << "void AbTable::insertIntoTable( const Opie::OPimContact& cnt, "
+ << row << " )" << oendl;
QString strName;
ContactItem contactItem;
strName = findContactName( cnt );
contactItem = findContactContact( cnt, row );
AbTableItem *ati;
ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value );
contactList.insert( ati, cnt );
setItem( row, 0, ati );
ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName);
if ( !contactItem.icon.isNull() )
@@ -248,25 +248,25 @@ 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() NOT POSSIBLE !!" );
+ Opie::Core::owarn << "void AbTable::resort() NOT POSSIBLE !!" << oendl;
#if 0
setPaintingEnabled( FALSE );
if ( sorting() ) {
if ( lastSortCol == -1 )
lastSortCol = 0;
sortColumn( lastSortCol, asc, TRUE );
//QMessageBox::information( this, "resort", "resort" );
updateVisible();
}
setPaintingEnabled( TRUE );
#endif
}
@@ -274,43 +274,43 @@ void AbTable::resort()
Opie::OPimContact AbTable::currentEntry()
{
return m_viewList[currentRow()];
}
int AbTable::currentEntry_UID()
{
return ( currentEntry().uid() );
}
void AbTable::clear()
{
- qWarning( "void AbTable::clear()" );
+ Opie::Core::owarn << "void AbTable::clear()" << oendl;
// 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() NOT IMPLEMENTED !!" );
+ Opie::Core::owarn << "void AbTable::refresh() NOT IMPLEMENTED !!" << oendl;
#if 0
int rows = numRows();
AbTableItem *abi;
ContactItem contactItem;
setPaintingEnabled( FALSE );
for ( int r = 0; r < rows; ++r ) {
abi = static_cast<AbTableItem*>( item(r, 0) );
contactItem = findContactContact( contactList[abi], r );
static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() );
if ( !contactItem.icon.isNull() ){
@@ -325,48 +325,48 @@ void AbTable::refresh()
setPaintingEnabled( TRUE );
#endif
}
void AbTable::keyPressEvent( QKeyEvent *e )
{
char key = toupper( e->ascii() );
if ( key >= 'A' && key <= 'Z' )
moveTo( key );
- // qWarning("Received key ..");
+ // Opie::Core::owarn << "Received key .." << oendl;
switch( e->key() ) {
case Qt::Key_Space:
case Qt::Key_Return:
case Qt::Key_Enter:
emit signalSwitch();
break;
// case Qt::Key_Up:
-// qWarning("a");
+// Opie::Core::owarn << "a" << oendl;
// emit signalKeyUp();
// break;
// case Qt::Key_Down:
-// qWarning("b");
+// Opie::Core::owarn << "b" << oendl;
// emit signalKeyDown();
// break;
default:
QTable::keyPressEvent( e );
}
}
void AbTable::moveTo( char c )
{
- qWarning( "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" );
+ Opie::Core::owarn << "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" << oendl;
#if 0
int rows = numRows();
QString value;
AbTableItem *abi;
int r;
if ( asc ) {
r = 0;
while ( r < rows-1) {
abi = static_cast<AbTableItem*>( item(r, 0) );
QChar first = abi->key()[0];
//### is there a bug in QChar to char comparison???
@@ -414,25 +414,25 @@ void AbTable::resizeRows() {
if (numRows()) {
for (int i = 0; i < numRows(); i++) {
setRowHeight( i, size );
}
}
updateVisible();
*/
}
void AbTable::realignTable()
{
- // qWarning( "void AbTable::realignTable()" );
+ // Opie::Core::owarn << "void AbTable::realignTable()" << oendl;
setPaintingEnabled( FALSE );
resizeRows();
fitColumns();
setPaintingEnabled( TRUE );
}
@@ -464,77 +464,77 @@ 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()" );
+ Opie::Core::owarn << "void AbTable::fitColumns()" << oendl;
int contentsWidth = visibleWidth() / 2;
// Fix to better value
// contentsWidth = 130;
setPaintingEnabled( FALSE );
if ( columnVisible == false ){
showColumn(0);
columnVisible = true;
}
- // qWarning("Width: %d", contentsWidth);
+ // Opie::Core::owarn << "Width: " << contentsWidth << oendl;
setColumnWidth( 0, contentsWidth );
adjustColumn(1);
if ( columnWidth(1) < contentsWidth )
setColumnWidth( 1, contentsWidth );
setPaintingEnabled( TRUE );
}
void AbTable::show()
{
- // qWarning( "void AbTable::show()" );
+ // Opie::Core::owarn << "void AbTable::show()" << oendl;
realignTable();
QTable::show();
}
#if 0
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();
}
#endif
void AbTable::itemClicked(int,int col)
{
- // qWarning( "AbTable::itemClicked(int, col:%d)", col);
+ // Opie::Core::owarn << "AbTable::itemClicked(int, col: " << col << ")" << oendl;
if ( col == 2 ) {
return;
} else {
- // qWarning ("Emitting signalSwitch()");
+ // Opie::Core::owarn << "Emitting signalSwitch()" << oendl;
emit signalSwitch();
}
}
#if 0
QStringList AbTable::choiceNames() const
{
return choicenames;
}
#endif
void AbTable::setChoiceSelection( const QValueList<int>& list )
@@ -553,25 +553,25 @@ QStringList AbTable::choiceSelection(int /*index*/) const
if ( text(row,2) == selname ) {
r.append(c->email);
}
}
*/
return r;
}
void AbTable::updateVisible()
{
- // qWarning("void AbTable::updateVisible()");
+ // Opie::Core::owarn << "void AbTable::updateVisible()" << oendl;
int visible,
totalRows,
row,
selectedRow = 0;
visible = 0;
setPaintingEnabled( FALSE );
realignTable();
@@ -589,55 +589,58 @@ void AbTable::updateVisible()
if ( selectedRow )
setCurrentCell( selectedRow, 0 );
if ( !visible )
setCurrentCell( -1, 0 );
setPaintingEnabled( TRUE );
}
void AbTable::setPaintingEnabled( bool e )
{
- // qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested );
+ // Opie::Core::owarn << "IN void AbTable::setPaintingEnabled( " << e << " )->Nested: "
+ // << countNested << oendl;
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 );
+ // Opie::Core::owarn << "OUT void AbTable::setPaintingEnabled( " << e << " )->Nested: "
+ // << countNested << oendl;
}
void AbTable::viewportPaintEvent( QPaintEvent* e ) {
- // qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting);
+ // Opie::Core::owarn << "void AbTable::viewportPaintEvent( QPaintEvent* e ) -> "
+ // << enablePainting << oendl;
if ( enablePainting )
QTable::viewportPaintEvent( e );
}
void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) {
const QColorGroup &cg = colorGroup();
p->save();
- //qWarning( "Paint row: %d", row );
+ // Opie::Core::owarn << "Paint row: " << row << oendl;
Opie::OPimContact act_contact = m_viewList[row];
// Paint alternating background bars
if ( (row % 2 ) == 0 ) {
p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) );
p->setPen( QPen( cg.text() ) );
}
else {
p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) );
p->setPen( QPen( cg.buttonText() ) );
}