summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/ablabel.cpp7
-rw-r--r--core/pim/addressbook/abtable.cpp113
-rw-r--r--core/pim/addressbook/abtable.h16
-rw-r--r--core/pim/addressbook/abview.cpp31
-rw-r--r--core/pim/addressbook/addressbook.cpp2
-rw-r--r--core/pim/addressbook/version.h2
6 files changed, 105 insertions, 66 deletions
diff --git a/core/pim/addressbook/ablabel.cpp b/core/pim/addressbook/ablabel.cpp
index 6d8de91..1914f71 100644
--- a/core/pim/addressbook/ablabel.cpp
+++ b/core/pim/addressbook/ablabel.cpp
@@ -72,8 +72,11 @@ bool AbLabel::selectContact( int UID )
{
- for ( m_itCurContact = m_viewList.begin(); m_itCurContact != m_viewList.end(); ++m_itCurContact){
- if ( (*m_itCurContact).uid() == UID )
+ for ( int r = 0; r < m_viewList.count(); ++r ) {
+ if ( m_viewList.uidAt( r ) == UID ){
+ m_itCurContact.setCurrent( r );
break;
+ }
}
+
sync();
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index a2617fa..4705c78 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -45,4 +45,6 @@
#include <ctype.h> //toupper() for key hack
+#if 0
+
/*!
\class AbTableItem abtable.h
@@ -113,4 +115,6 @@ void AbPickItem::setContentFromEditor( QWidget *w )
}
+#endif
+
/*!
\class AbTable abtable.h
@@ -136,5 +140,5 @@ AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name
this, SLOT(itemClicked(int,int)) );
- contactList.clear();
+ // contactList.clear();
// qWarning("C'tor end");
}
@@ -159,5 +163,5 @@ void AbTable::init()
void AbTable::setContacts( const OContactAccess::List& viewList )
{
- // qWarning("AbTable::setContacts()");
+ qWarning("AbTable::setContacts()");
clear();
@@ -169,11 +173,11 @@ void AbTable::setContacts( const OContactAccess::List& viewList )
OContactAccess::List::Iterator it;
setNumRows( m_viewList.count() );
- int row = 0;
- for ( it = m_viewList.begin(); it != m_viewList.end(); ++it )
- insertIntoTable( *it, row++ );
+// int row = 0;
+// for ( it = m_viewList.begin(); it != m_viewList.end(); ++it )
+// insertIntoTable( *it, row++ );
- setSorting( true );
+// setSorting( true );
- resort();
+// resort();
updateVisible();
@@ -191,15 +195,13 @@ void AbTable::setOrderedList( const QValueList<int> ordered )
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 );
+ qWarning( "search start" );
for ( int r = 0; r < rows; ++r ) {
- abi = static_cast<AbTableItem*>( item(r, 0) );
- foundContact = &contactList[abi];
- if ( foundContact -> uid() == UID ){
+ if ( m_viewList.uidAt( r ) == UID ){
ensureCellVisible( r, 0 );
setCurrentCell( r, 0 );
@@ -208,4 +210,5 @@ bool AbTable::selectContact( int UID )
}
}
+ qWarning( "search end" );
if ( !found ){
@@ -219,7 +222,8 @@ bool AbTable::selectContact( int UID )
}
+#if 0
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;
ContactItem contactItem;
@@ -241,5 +245,5 @@ void AbTable::insertIntoTable( const OContact& cnt, int row )
}
-
+#endif
@@ -264,5 +268,6 @@ void AbTable::columnClicked( int col )
void AbTable::resort()
{
- // qWarning( "void AbTable::resort()" );
+ qWarning( "void AbTable::resort() NOT POSSIBLE !!" );
+#if 0
setPaintingEnabled( FALSE );
if ( sorting() ) {
@@ -274,17 +279,10 @@ void AbTable::resort()
}
setPaintingEnabled( TRUE );
+#endif
}
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;
+{
+ return m_viewList[currentRow()];
}
@@ -296,6 +294,6 @@ int AbTable::currentEntry_UID()
void AbTable::clear()
{
- // qWarning( "void AbTable::clear()" );
- contactList.clear();
+ qWarning( "void AbTable::clear()" );
+ // contactList.clear();
setPaintingEnabled( FALSE );
@@ -314,5 +312,7 @@ void AbTable::clear()
void AbTable::refresh()
{
- // qWarning( "void AbTable::refresh()" );
+ qWarning( "void AbTable::refresh() NOT IMPLEMENTED !!" );
+
+#if 0
int rows = numRows();
AbTableItem *abi;
@@ -334,4 +334,6 @@ void AbTable::refresh()
resort();
setPaintingEnabled( TRUE );
+
+#endif
}
@@ -366,6 +368,7 @@ void AbTable::keyPressEvent( QKeyEvent *e )
void AbTable::moveTo( char c )
{
- qWarning( "void AbTable::moveTo( char c )" );
+ qWarning( "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" );
+#if 0
int rows = numRows();
QString value;
@@ -395,7 +398,10 @@ void AbTable::moveTo( char c )
}
setCurrentCell( r, currentColumn() );
-}
+#endif
+}
+#if 0
+// Useless.. Nobody uses it .. (se)
QString AbTable::findContactName( const OContact &entry )
{
@@ -411,5 +417,5 @@ QString AbTable::findContactName( const OContact &entry )
return str;
}
-
+#endif
@@ -507,4 +513,5 @@ void AbTable::show()
}
+#if 0
void AbTable::setChoiceNames( const QStringList& list)
{
@@ -521,4 +528,5 @@ void AbTable::setChoiceNames( const QStringList& list)
fitColumns();
}
+#endif
void AbTable::itemClicked(int,int col)
@@ -533,4 +541,5 @@ void AbTable::itemClicked(int,int col)
}
+#if 0
QStringList AbTable::choiceNames() const
{
@@ -538,4 +547,5 @@ QStringList AbTable::choiceNames() const
}
+#endif
void AbTable::setChoiceSelection( const QValueList<int>& list )
{
@@ -561,6 +571,4 @@ QStringList AbTable::choiceSelection(int /*index*/) const
-
-
void AbTable::updateVisible()
{
@@ -631,4 +639,8 @@ 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];
+
// Paint alternating background bars
if ( (row % 2 ) == 0 ) {
@@ -648,15 +660,30 @@ void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool )
int y = ( cr.height() - 14 ) / 2;
- QPixmap pic = pixmap( row, col );
- if ( !pic.isNull() )
- {
- p->drawPixmap( x + marg, y, pixmap( row, col ) );
- p->drawText( x + marg + pixmap( row, col ).width() + 4,2 + fm.ascent(), text( row, col ) );
- }
- else
- {
- p->drawText( x + marg,2 + fm.ascent(), text( row, col ) );
- }
+ QString nameText = act_contact.fileAs();
+
+ switch( col ){
+ 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()
+ + 4,2 + fm.ascent(), contactText );
+ }
+ else
+ {
+ p->drawText( x + marg,2 + fm.ascent(), contactText );
+ }
+ }
+ break;
+ }
p->restore();
}
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h
index 0f7bc29..b9ebe27 100644
--- a/core/pim/addressbook/abtable.h
+++ b/core/pim/addressbook/abtable.h
@@ -33,4 +33,5 @@
#include <qpixmap.h>
+#if 0
class AbTableItem : public QTableItem
{
@@ -48,4 +49,6 @@ private:
};
+#endif
+
// This is a simple container, storing all contact
// information
@@ -57,4 +60,5 @@ class ContactItem
};
+#if 0
class AbPickItem : public QTableItem
{
@@ -69,4 +73,6 @@ private:
};
+#endif
+
class AbTable : public QTable
{
@@ -92,5 +98,5 @@ public:
int currentEntry_UID();
- QString findContactName( const OContact &entry );
+ // QString findContactName( const OContact &entry );
void init();
@@ -104,6 +110,6 @@ public:
// addresspicker mode (What's that ? se)
- void setChoiceNames( const QStringList& list);
- QStringList choiceNames() const;
+ // void setChoiceNames( const QStringList& list);
+ // QStringList choiceNames() const;
void setChoiceSelection( const QValueList<int>& list );
QStringList choiceSelection(int index) const;
@@ -130,5 +136,5 @@ protected slots:
private:
- void insertIntoTable( const OContact &cnt, int row );
+ // void insertIntoTable( const OContact &cnt, int row );
ContactItem findContactContact( const OContact &entry, int row );
void fitColumns();
@@ -140,5 +146,5 @@ private:
int lastSortCol;
bool asc;
- QMap<AbTableItem*, OContact> contactList;
+ // QMap<AbTableItem*, OContact> contactList;
QValueList<int> intFields;
QStringList choicenames;
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 477f85b..6cbd556 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -52,4 +52,5 @@ AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
m_orderedFields( ordered )
{
+ qWarning("AbView::c'tor");
// Load default database and handle syncing myself.. !
m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ),
@@ -98,5 +99,5 @@ AbView::~AbView()
void AbView::setView( Views view )
{
- // qWarning("AbView::setView( Views view )");
+ qWarning("AbView::setView( Views view )");
m_curr_View = view;
load();
@@ -105,5 +106,5 @@ void AbView::setView( Views view )
void AbView::addEntry( const OContact &newContact )
{
- // qWarning("abview:AddContact");
+ qWarning("abview:AddContact");
m_contactdb->add ( newContact );
load();
@@ -112,5 +113,5 @@ void AbView::addEntry( const OContact &newContact )
void AbView::removeEntry( const int UID )
{
- // qWarning("abview:RemoveContact");
+ qWarning("abview:RemoveContact");
m_contactdb->remove( UID );
load();
@@ -119,5 +120,5 @@ void AbView::removeEntry( const int UID )
void AbView::replaceEntry( const OContact &contact )
{
- // qWarning("abview:ReplaceContact");
+ qWarning("abview:ReplaceContact");
m_contactdb->replace( contact );
load();
@@ -150,5 +151,5 @@ bool AbView::save()
void AbView::load()
{
- // qWarning("abView:Load data");
+ qWarning("abView:Load data");
// Letter Search is stopped at this place
@@ -160,5 +161,6 @@ void AbView::load()
else{
m_list = m_contactdb->sorted( true, 0, 0, 0 );
- clearForCategory();
+ if ( m_curr_category != -1 )
+ clearForCategory();
}
@@ -171,5 +173,5 @@ void AbView::load()
void AbView::reload()
{
- // qWarning( "void AbView::reload()" );
+ qWarning( "void AbView::reload()" );
m_contactdb->reload();
@@ -184,5 +186,5 @@ void AbView::clear()
void AbView::setShowByCategory( const QString& cat )
{
- // qWarning("AbView::setShowCategory( const QString& cat )");
+ qWarning("AbView::setShowCategory( const QString& cat )");
int intCat = 0;
@@ -208,9 +210,8 @@ void AbView::setShowByCategory( const QString& cat )
void AbView::setShowToView( Views view )
{
- // qWarning("void AbView::setShowToView( View %d )", view);
-
- // qWarning ("Change the View (Category is: %d)", m_curr_category);
+ qWarning("void AbView::setShowToView( View %d )", view);
if ( m_curr_View != view ){
+ qWarning ("Change the View (Category is: %d)", m_curr_category);
m_prev_View = m_curr_View;
m_curr_View = view;
@@ -251,5 +252,6 @@ void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode )
}
m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase );
- clearForCategory();
+ if ( m_curr_category != -1 )
+ clearForCategory();
m_curr_Contact = 0;
}
@@ -275,5 +277,5 @@ QString AbView::showCategory() const
void AbView::showPersonal( bool personal )
{
- // qWarning ("void AbView::showPersonal( %d )", personal);
+ qWarning ("void AbView::showPersonal( %d )", personal);
if ( personal ){
@@ -363,5 +365,6 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
// This algorithm is a litte bit ineffective, but
// we will not have a lot of matching entries..
- clearForCategory();
+ if ( m_curr_category != -1 )
+ clearForCategory();
// Now show all found entries
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 03c96c8..0ba024e 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -249,5 +249,5 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) );
- m_abView->load();
+ // m_abView->load(); // Already done by c'tor .
// Letter Picker
diff --git a/core/pim/addressbook/version.h b/core/pim/addressbook/version.h
index 9621826..790aa95 100644
--- a/core/pim/addressbook/version.h
+++ b/core/pim/addressbook/version.h
@@ -3,5 +3,5 @@
#define MAINVERSION "1"
-#define SUBVERSION "0"
+#define SUBVERSION "1"
#define PATCHVERSION "0"