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
@@ -73,6 +73,9 @@ 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
@@ -46,2 +46,4 @@
+#if 0
+
/*!
@@ -114,2 +116,4 @@ void AbPickItem::setContentFromEditor( QWidget *w )
+#endif
+
/*!
@@ -137,3 +141,3 @@ AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name
- contactList.clear();
+ // contactList.clear();
// qWarning("C'tor end");
@@ -160,3 +164,3 @@ void AbTable::setContacts( const OContactAccess::List& viewList )
{
- // qWarning("AbTable::setContacts()");
+ qWarning("AbTable::setContacts()");
@@ -170,9 +174,9 @@ void AbTable::setContacts( const OContactAccess::List& viewList )
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();
@@ -192,5 +196,4 @@ bool AbTable::selectContact( int UID )
{
- // qWarning( "AbTable::selectContact( %d )", UID );
+ qWarning( "AbTable::selectContact( %d )", UID );
int rows = numRows();
- AbTableItem *abi;
OContact* foundContact = 0l;
@@ -199,6 +202,5 @@ bool AbTable::selectContact( int UID )
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 );
@@ -209,2 +211,3 @@ bool AbTable::selectContact( int UID )
}
+ qWarning( "search end" );
@@ -220,5 +223,6 @@ 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;
@@ -242,3 +246,3 @@ void AbTable::insertIntoTable( const OContact& cnt, int row )
}
-
+#endif
@@ -265,3 +269,4 @@ void AbTable::resort()
{
- // qWarning( "void AbTable::resort()" );
+ qWarning( "void AbTable::resort() NOT POSSIBLE !!" );
+#if 0
setPaintingEnabled( FALSE );
@@ -275,2 +280,3 @@ void AbTable::resort()
setPaintingEnabled( TRUE );
+#endif
}
@@ -278,12 +284,4 @@ void AbTable::resort()
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()];
}
@@ -297,4 +295,4 @@ void AbTable::clear()
{
- // qWarning( "void AbTable::clear()" );
- contactList.clear();
+ qWarning( "void AbTable::clear()" );
+ // contactList.clear();
@@ -315,3 +313,5 @@ void AbTable::refresh()
{
- // qWarning( "void AbTable::refresh()" );
+ qWarning( "void AbTable::refresh() NOT IMPLEMENTED !!" );
+
+#if 0
int rows = numRows();
@@ -335,2 +335,4 @@ void AbTable::refresh()
setPaintingEnabled( TRUE );
+
+#endif
}
@@ -367,4 +369,5 @@ void AbTable::moveTo( char c )
{
- qWarning( "void AbTable::moveTo( char c )" );
+ qWarning( "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" );
+#if 0
int rows = numRows();
@@ -396,5 +399,8 @@ void AbTable::moveTo( char c )
setCurrentCell( r, currentColumn() );
-}
+#endif
+}
+#if 0
+// Useless.. Nobody uses it .. (se)
QString AbTable::findContactName( const OContact &entry )
@@ -412,3 +418,3 @@ QString AbTable::findContactName( const OContact &entry )
}
-
+#endif
@@ -508,2 +514,3 @@ void AbTable::show()
+#if 0
void AbTable::setChoiceNames( const QStringList& list)
@@ -522,2 +529,3 @@ void AbTable::setChoiceNames( const QStringList& list)
}
+#endif
@@ -534,2 +542,3 @@ void AbTable::itemClicked(int,int col)
+#if 0
QStringList AbTable::choiceNames() const
@@ -539,2 +548,3 @@ QStringList AbTable::choiceNames() const
+#endif
void AbTable::setChoiceSelection( const QValueList<int>& list )
@@ -562,4 +572,2 @@ QStringList AbTable::choiceSelection(int /*index*/) const
-
-
void AbTable::updateVisible()
@@ -632,2 +640,6 @@ void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool )
+ //qWarning( "Paint row: %d", row );
+
+ OContact act_contact = m_viewList[row];
+
// Paint alternating background bars
@@ -649,13 +661,28 @@ void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool )
- 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
@@ -34,2 +34,3 @@
+#if 0
class AbTableItem : public QTableItem
@@ -49,2 +50,4 @@ private:
+#endif
+
// This is a simple container, storing all contact
@@ -58,2 +61,3 @@ class ContactItem
+#if 0
class AbPickItem : public QTableItem
@@ -70,2 +74,4 @@ private:
+#endif
+
class AbTable : public QTable
@@ -93,3 +99,3 @@ public:
- QString findContactName( const OContact &entry );
+ // QString findContactName( const OContact &entry );
@@ -105,4 +111,4 @@ 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 );
@@ -131,3 +137,3 @@ protected slots:
private:
- void insertIntoTable( const OContact &cnt, int row );
+ // void insertIntoTable( const OContact &cnt, int row );
ContactItem findContactContact( const OContact &entry, int row );
@@ -141,3 +147,3 @@ private:
bool asc;
- QMap<AbTableItem*, OContact> contactList;
+ // QMap<AbTableItem*, OContact> contactList;
QValueList<int> intFields;
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
@@ -53,2 +53,3 @@ AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
{
+ qWarning("AbView::c'tor");
// Load default database and handle syncing myself.. !
@@ -99,3 +100,3 @@ void AbView::setView( Views view )
{
- // qWarning("AbView::setView( Views view )");
+ qWarning("AbView::setView( Views view )");
m_curr_View = view;
@@ -106,3 +107,3 @@ void AbView::addEntry( const OContact &newContact )
{
- // qWarning("abview:AddContact");
+ qWarning("abview:AddContact");
m_contactdb->add ( newContact );
@@ -113,3 +114,3 @@ void AbView::removeEntry( const int UID )
{
- // qWarning("abview:RemoveContact");
+ qWarning("abview:RemoveContact");
m_contactdb->remove( UID );
@@ -120,3 +121,3 @@ void AbView::replaceEntry( const OContact &contact )
{
- // qWarning("abview:ReplaceContact");
+ qWarning("abview:ReplaceContact");
m_contactdb->replace( contact );
@@ -151,3 +152,3 @@ void AbView::load()
{
- // qWarning("abView:Load data");
+ qWarning("abView:Load data");
@@ -161,3 +162,4 @@ void AbView::load()
m_list = m_contactdb->sorted( true, 0, 0, 0 );
- clearForCategory();
+ if ( m_curr_category != -1 )
+ clearForCategory();
}
@@ -172,3 +174,3 @@ void AbView::reload()
{
- // qWarning( "void AbView::reload()" );
+ qWarning( "void AbView::reload()" );
@@ -185,3 +187,3 @@ void AbView::setShowByCategory( const QString& cat )
{
- // qWarning("AbView::setShowCategory( const QString& cat )");
+ qWarning("AbView::setShowCategory( const QString& cat )");
@@ -209,7 +211,6 @@ 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;
@@ -252,3 +253,4 @@ 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;
@@ -276,3 +278,3 @@ void AbView::showPersonal( bool personal )
{
- // qWarning ("void AbView::showPersonal( %d )", personal);
+ qWarning ("void AbView::showPersonal( %d )", personal);
@@ -364,3 +366,4 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
// we will not have a lot of matching entries..
- clearForCategory();
+ if ( m_curr_category != -1 )
+ clearForCategory();
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
@@ -250,3 +250,3 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
- m_abView->load();
+ // m_abView->load(); // Already done by c'tor .
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
@@ -4,3 +4,3 @@
#define MAINVERSION "1"
-#define SUBVERSION "0"
+#define SUBVERSION "1"
#define PATCHVERSION "0"