summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp13
-rw-r--r--core/pim/addressbook/abtable.h4
-rw-r--r--core/pim/addressbook/abview.cpp4
3 files changed, 19 insertions, 2 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index a829dc2..a2617fa 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -161,48 +161,54 @@ void AbTable::setContacts( const OContactAccess::List& viewList )
// 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++ );
setSorting( true );
resort();
updateVisible();
setPaintingEnabled( TRUE );
}
+void AbTable::setOrderedList( const QValueList<int> ordered )
+{
+ intFields = ordered;
+}
+
+
bool AbTable::selectContact( int 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 );
found = true;
break;
}
}
if ( !found ){
ensureCellVisible( 0,0 );
setCurrentCell( 0, 0 );
}
@@ -296,52 +302,55 @@ void AbTable::clear()
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()" );
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() )
+ if ( !contactItem.icon.isNull() ){
static_cast<AbTableItem*>( item(r, 1) )->
setPixmap( contactItem.icon );
-
+ }else{
+ static_cast<AbTableItem*>( item(r, 1) )->
+ setPixmap( QPixmap() );
+ }
}
resort();
setPaintingEnabled( TRUE );
}
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:
case Qt::Key_Enter:
emit signalSwitch();
break;
// case Qt::Key_Up:
// qWarning("a");
// emit signalKeyUp();
// break;
// case Qt::Key_Down:
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h
index 4e6b294..0f7bc29 100644
--- a/core/pim/addressbook/abtable.h
+++ b/core/pim/addressbook/abtable.h
@@ -57,48 +57,52 @@ class ContactItem
};
class AbPickItem : public QTableItem
{
public:
AbPickItem( QTable *t );
QWidget *createEditor() const;
void setContentFromEditor( QWidget *w );
private:
QGuardedPtr<QComboBox> cb;
};
class AbTable : public QTable
{
Q_OBJECT
public:
AbTable( const QValueList<int> ordered, QWidget *parent, const char *name=0 );
~AbTable();
// Set the contacts shown in the table
void setContacts( const OContactAccess::List& viewList );
+
+ // Set the list for primary contacts
+ void setOrderedList( const QValueList<int> ordered );
+
// Selects a contact of a specific UID
bool selectContact( int UID );
// Get the current selected entry
OContact currentEntry();
// Get the UID of the current selected Entry
int currentEntry_UID();
QString findContactName( const OContact &entry );
void init();
void clear();
void refresh();
void show();
void setPaintingEnabled( bool e );
void viewportPaintEvent( QPaintEvent* e);
void paintCell(QPainter* p, int row, int col, const QRect&, bool );
// addresspicker mode (What's that ? se)
void setChoiceNames( const QStringList& list);
QStringList choiceNames() const;
void setChoiceSelection( const QValueList<int>& list );
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 7da0992..b89b794 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -222,48 +222,52 @@ void AbView::setShowByLetter( char c )
{
// qWarning("void AbView::setShowByLetter( %c )", c );
OContact query;
if ( c == 0 ){
load();
return;
}else{
// If the current Backend is unable to solve the query, we will
// ignore the request ..
if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){
return;
}
query.setLastName( QString("%1*").arg(c) );
m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase );
clearForCategory();
m_curr_Contact = 0;
}
updateView( true );
}
void AbView::setListOrder( const QValueList<int>& ordered )
{
m_orderedFields = ordered;
+ if ( m_abTable ){
+ m_abTable->setOrderedList( ordered );
+ m_abTable->refresh();
+ }
updateView();
}
QString AbView::showCategory() const
{
return mCat.label( "Contacts", m_curr_category );
}
void AbView::showPersonal( bool personal )
{
// qWarning ("void AbView::showPersonal( %d )", personal);
if ( personal ){
if ( m_inPersonal )
return;
// Now switch to vCard Backend and load data.
// The current default backend will be stored
// to avoid unneeded load/stores.
m_storedDB = m_contactdb;
OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,