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.cpp85
1 files changed, 42 insertions, 43 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 29f4383..cd77b13 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -19,14 +19,13 @@
**
**********************************************************************/
+#include <opie2/opimrecordlist.h>
+
#include <qpe/timestring.h>
#include <qpe/resource.h>
-#include <opie/orecordlist.h>
-
-
#include "abtable.h"
#include <errno.h>
#include <fcntl.h>
@@ -38,9 +37,9 @@
#if 0
/*!
\class AbTableItem abtable.h
-
+
\brief QTableItem based class for showing a field of an entry
*/
AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s,
@@ -65,15 +64,15 @@ QString AbTableItem::key() const
void AbTableItem::setItem( const QString &txt, const QString &secondKey )
{
setText( txt );
sortKey = Qtopia::buildSortKey( txt, secondKey );
-
+
// sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower();
}
/*!
\class AbPickItem abtable.h
-
+
\brief QTableItem based class for showing slection of an entry
*/
AbPickItem::AbPickItem( QTable *t ) :
@@ -108,9 +107,9 @@ void AbPickItem::setContentFromEditor( QWidget *w )
#endif
/*!
\class AbTable abtable.h
-
+
\brief QTable based class for showing a list of entries
*/
AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name )
@@ -142,32 +141,32 @@ 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 )
+void AbTable::setContacts( const Opie::OPimContactAccess::List& viewList )
{
qWarning("AbTable::setContacts()");
clear();
m_viewList = viewList;
setSorting( false );
setPaintingEnabled( FALSE );
-
- OContactAccess::List::Iterator it;
+
+ 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++ );
-
+
// setSorting( true );
// resort();
@@ -186,9 +185,9 @@ void AbTable::setOrderedList( const QValueList<int> ordered )
bool AbTable::selectContact( int UID )
{
qWarning( "AbTable::selectContact( %d )", UID );
int rows = numRows();
- OContact* foundContact = 0l;
+ Opie::OPimContact* foundContact = 0l;
bool found = false;
setPaintingEnabled( FALSE );
qWarning( "search start" );
@@ -212,41 +211,41 @@ bool AbTable::selectContact( int UID )
return true;
}
#if 0
-void AbTable::insertIntoTable( const OContact& cnt, int row )
+void AbTable::insertIntoTable( const Opie::OPimContact& cnt, int row )
{
- qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row );
+ qWarning( "void AbTable::insertIntoTable( const Opie::OPimContact& cnt, %d )", row );
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() )
ati->setPixmap( contactItem.icon );
setItem( row, 1, ati );
-
+
//### cannot do this; table only has two columns at this point
// setItem( row, 2, new AbPickItem( this ) );
-
+
}
#endif
void AbTable::columnClicked( int col )
{
if ( !sorting() )
return;
-
+
if ( lastSortCol == -1 )
lastSortCol = col;
-
+
if ( col == lastSortCol ) {
asc = !asc;
} else {
lastSortCol = col;
@@ -271,10 +270,10 @@ void AbTable::resort()
setPaintingEnabled( TRUE );
#endif
}
-OContact AbTable::currentEntry()
-{
+Opie::OPimContact AbTable::currentEntry()
+{
return m_viewList[currentRow()];
}
int AbTable::currentEntry_UID()
@@ -330,12 +329,12 @@ void AbTable::refresh()
void AbTable::keyPressEvent( QKeyEvent *e )
{
char key = toupper( e->ascii() );
-
+
if ( key >= 'A' && key <= 'Z' )
moveTo( key );
-
+
// qWarning("Received key ..");
switch( e->key() ) {
case Qt::Key_Space:
case Qt::Key_Return:
@@ -352,15 +351,15 @@ void AbTable::keyPressEvent( QKeyEvent *e )
// break;
default:
QTable::keyPressEvent( e );
}
-
+
}
void AbTable::moveTo( char c )
{
qWarning( "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" );
-
+
#if 0
int rows = numRows();
QString value;
AbTableItem *abi;
@@ -393,9 +392,9 @@ void AbTable::moveTo( char c )
}
#if 0
// Useless.. Nobody uses it .. (se)
-QString AbTable::findContactName( const OContact &entry )
+QString AbTable::findContactName( const Opie::OPimContact &entry )
{
// We use the fileAs, then company, defaultEmail
QString str;
str = entry.fileAs();
@@ -474,19 +473,19 @@ void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch )
void AbTable::fitColumns()
{
qWarning( "void AbTable::fitColumns()" );
- int contentsWidth = visibleWidth() / 2;
+ int contentsWidth = visibleWidth() / 2;
// Fix to better value
- // contentsWidth = 130;
+ // contentsWidth = 130;
setPaintingEnabled( FALSE );
-
+
if ( columnVisible == false ){
showColumn(0);
columnVisible = true;
}
-
+
// qWarning("Width: %d", contentsWidth);
setColumnWidth( 0, contentsWidth );
adjustColumn(1);
@@ -546,17 +545,17 @@ void AbTable::setChoiceSelection( const QValueList<int>& list )
QStringList AbTable::choiceSelection(int /*index*/) const
{
QStringList r;
/* ######
-
+
QString selname = choicenames.at(index);
for (each row) {
- OContact *c = contactForRow(row);
+ Opie::OPimContact *c = contactForRow(row);
if ( text(row,2) == selname ) {
r.append(c->email);
}
}
-
+
*/
return r;
}
@@ -568,11 +567,11 @@ void AbTable::updateVisible()
int visible,
totalRows,
row,
selectedRow = 0;
-
+
visible = 0;
-
+
setPaintingEnabled( FALSE );
realignTable();
@@ -591,9 +590,9 @@ void AbTable::updateVisible()
setCurrentCell( selectedRow, 0 );
if ( !visible )
setCurrentCell( -1, 0 );
-
+
setPaintingEnabled( TRUE );
}
@@ -630,9 +629,9 @@ void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool )
p->save();
//qWarning( "Paint row: %d", row );
- OContact act_contact = m_viewList[row];
+ 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 ) );
@@ -652,21 +651,21 @@ void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool )
QString nameText = act_contact.fileAs();
switch( col ){
- case 0:
+ case 0:
p->drawText( x + marg,2 + fm.ascent(), nameText );
break;
case 1:{
ContactItem contactItem = findContactContact( act_contact, 0 );
QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */
QString contactText = contactItem.value;
-
+
if ( !contactPic.isNull() )
{
p->drawPixmap( x + marg, y, contactPic );
- p->drawText( x + marg + contactPic.width()
+ p->drawText( x + marg + contactPic.width()
+ 4,2 + fm.ascent(), contactText );
}
else
{
@@ -683,9 +682,9 @@ void AbTable::rowHeightChanged( int row )
{
if ( enablePainting )
QTable::rowHeightChanged( row );
}
-ContactItem AbTable::findContactContact( const OContact &entry, int /* row */ )
+ContactItem AbTable::findContactContact( const Opie::OPimContact &entry, int /* row */ )
{
ContactItem item;