summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp93
-rw-r--r--core/pim/addressbook/abtable.h1
-rw-r--r--core/pim/addressbook/abview.cpp14
-rw-r--r--core/pim/addressbook/abview.h2
-rw-r--r--core/pim/addressbook/version.h4
5 files changed, 23 insertions, 91 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 49e66ad..60f3177 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -121,13 +121,14 @@ AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name
121 columnVisible( true ), 121 columnVisible( true ),
122 countNested( 0 ) 122 countNested( 0 )
123{ 123{
124 //odebug << "C'tor start" << oendl; 124 //odebug << "C'tor start" << oendl;
125 setSelectionMode( NoSelection ); 125 setSelectionMode( NoSelection );
126 init(); 126 init();
127 setSorting( TRUE ); 127 setSorting( false ); // The table should not sort by itself!
128
128 connect( this, SIGNAL(clicked(int,int,int,const QPoint&)), 129 connect( this, SIGNAL(clicked(int,int,int,const QPoint&)),
129 this, SLOT(itemClicked(int,int)) ); 130 this, SLOT(itemClicked(int,int)) );
130 131
131 // contactList.clear(); 132 // contactList.clear();
132 //odebug << "C'tor end" << oendl; 133 //odebug << "C'tor end" << oendl;
133} 134}
@@ -153,23 +154,16 @@ void AbTable::setContacts( const Opie::OPimContactAccess::List& viewList )
153{ 154{
154 odebug << "AbTable::setContacts()" << oendl; 155 odebug << "AbTable::setContacts()" << oendl;
155 156
156 clear(); 157 clear();
157 m_viewList = viewList; 158 m_viewList = viewList;
158 159
159 setSorting( false );
160 setPaintingEnabled( FALSE ); 160 setPaintingEnabled( FALSE );
161 161
162 setNumRows( m_viewList.count() ); 162 setNumRows( m_viewList.count() );
163 //int row = 0;
164 // for ( it = m_viewList.begin(); it != m_viewList.end(); ++it )
165 // insertIntoTable( *it, row++ );
166
167 // setSorting( true );
168 163
169 // resort();
170 164
171 updateVisible(); 165 updateVisible();
172 166
173 setPaintingEnabled( TRUE ); 167 setPaintingEnabled( TRUE );
174 168
175} 169}
@@ -205,71 +199,28 @@ bool AbTable::selectContact( int UID )
205 199
206 setPaintingEnabled( TRUE ); 200 setPaintingEnabled( TRUE );
207 201
208 return true; 202 return true;
209} 203}
210 204
211#if 0
212void AbTable::insertIntoTable( const Opie::OPimContact& cnt, int row )
213{
214 odebug << "void AbTable::insertIntoTable( const Opie::OPimContact& cnt, "
215 << row << " )" << oendl;
216 QString strName;
217 ContactItem contactItem;
218
219 strName = findContactName( cnt );
220 contactItem = findContactContact( cnt, row );
221
222 AbTableItem *ati;
223 ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value );
224 contactList.insert( ati, cnt );
225 setItem( row, 0, ati );
226 ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName);
227 if ( !contactItem.icon.isNull() )
228 ati->setPixmap( contactItem.icon );
229 setItem( row, 1, ati );
230
231 //### cannot do this; table only has two columns at this point
232 // setItem( row, 2, new AbPickItem( this ) );
233
234}
235#endif
236
237 205
238void AbTable::columnClicked( int col ) 206void AbTable::columnClicked( int col )
239{ 207{
240 if ( !sorting() ) 208 odebug << "columClicked(" << col << ")" << oendl;
241 return;
242
243 if ( lastSortCol == -1 )
244 lastSortCol = col;
245 209
246 if ( col == lastSortCol ) { 210 if ( col == 0 ){
211 odebug << "Change sort order: " << asc << oendl;
247 asc = !asc; 212 asc = !asc;
248 } else { 213 emit signalSortOrderChanged( asc );
249 lastSortCol = col;
250 asc = TRUE;
251 } 214 }
252 //QMessageBox::information( this, "resort", "columnClicked" );
253 resort();
254} 215}
255 216
256void AbTable::resort() 217void AbTable::resort()
257{ 218{
258 owarn << "void AbTable::resort() NOT POSSIBLE !!" << oendl; 219 owarn << "void AbTable::resort() NOT POSSIBLE !!" << oendl;
259#if 0 220
260 setPaintingEnabled( FALSE );
261 if ( sorting() ) {
262 if ( lastSortCol == -1 )
263 lastSortCol = 0;
264 sortColumn( lastSortCol, asc, TRUE );
265 //QMessageBox::information( this, "resort", "resort" );
266 updateVisible();
267 }
268 setPaintingEnabled( TRUE );
269#endif
270} 221}
271 222
272Opie::OPimContact AbTable::currentEntry() 223Opie::OPimContact AbTable::currentEntry()
273{ 224{
274 return m_viewList[currentRow()]; 225 return m_viewList[currentRow()];
275} 226}
@@ -354,42 +305,12 @@ void AbTable::keyPressEvent( QKeyEvent *e )
354} 305}
355 306
356void AbTable::moveTo( char /*c*/ ) 307void AbTable::moveTo( char /*c*/ )
357{ 308{
358 odebug << "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" << oendl; 309 odebug << "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" << oendl;
359 310
360#if 0
361 int rows = numRows();
362 QString value;
363 AbTableItem *abi;
364 int r;
365 if ( asc ) {
366 r = 0;
367 while ( r < rows-1) {
368 abi = static_cast<AbTableItem*>( item(r, 0) );
369 QChar first = abi->key()[0];
370 //### is there a bug in QChar to char comparison???
371 if ( first.row() || first.cell() >= c )
372 break;
373 r++;
374 }
375 } else {
376 //### should probably disable reverse sorting instead
377 r = rows - 1;
378 while ( r > 0 ) {
379 abi = static_cast<AbTableItem*>( item(r, 0) );
380 QChar first = abi->key()[0];
381 //### is there a bug in QChar to char comparison???
382 if ( first.row() || first.cell() >= c )
383 break;
384 r--;
385 }
386 }
387 setCurrentCell( r, currentColumn() );
388
389#endif
390} 311}
391 312
392#if 0 313#if 0
393// Useless.. Nobody uses it .. (se) 314// Useless.. Nobody uses it .. (se)
394QString AbTable::findContactName( const Opie::OPimContact &entry ) 315QString AbTable::findContactName( const Opie::OPimContact &entry )
395{ 316{
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h
index 927a5a9..7d2818b 100644
--- a/core/pim/addressbook/abtable.h
+++ b/core/pim/addressbook/abtable.h
@@ -117,12 +117,13 @@ public:
117 117
118signals: 118signals:
119 void signalSwitch(); 119 void signalSwitch();
120 void signalEditor(); 120 void signalEditor();
121 void signalKeyDown(); 121 void signalKeyDown();
122 void signalKeyUp(); 122 void signalKeyUp();
123 void signalSortOrderChanged( bool order );
123 124
124protected: 125protected:
125 virtual void keyPressEvent( QKeyEvent *e ); 126 virtual void keyPressEvent( QKeyEvent *e );
126 127
127// int rowHeight( int ) const; 128// int rowHeight( int ) const;
128// int rowPos( int row ) const; 129// int rowPos( int row ) const;
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 8a2db96..9f7f71f 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -39,12 +39,13 @@ QString addressbookPersonalVCardName()
39 39
40AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): 40AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
41 QWidget(parent), 41 QWidget(parent),
42 mCat(0), 42 mCat(0),
43 m_inSearch( false ), 43 m_inSearch( false ),
44 m_inPersonal( false ), 44 m_inPersonal( false ),
45 m_sortOrder( true ),
45 m_curr_category( 0 ), 46 m_curr_category( 0 ),
46 m_curr_View( TableView ), 47 m_curr_View( TableView ),
47 m_prev_View( TableView ), 48 m_prev_View( TableView ),
48 m_curr_Contact ( 0 ), 49 m_curr_Contact ( 0 ),
49 m_contactdb ( 0l ), 50 m_contactdb ( 0l ),
50 m_storedDB ( 0l ), 51 m_storedDB ( 0l ),
@@ -77,12 +78,14 @@ AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
77 m_ablabel = new AbLabel( cardBox, "CardView"); 78 m_ablabel = new AbLabel( cardBox, "CardView");
78 m_viewStack -> addWidget( cardBox , CardView ); 79 m_viewStack -> addWidget( cardBox , CardView );
79 80
80 // Connect views to me 81 // Connect views to me
81 connect ( m_abTable, SIGNAL( signalSwitch(void) ), 82 connect ( m_abTable, SIGNAL( signalSwitch(void) ),
82 this, SLOT( slotSwitch(void) ) ); 83 this, SLOT( slotSwitch(void) ) );
84 connect ( m_abTable, SIGNAL( signalSortOrderChanged( bool ) ),
85 this, SLOT( slotSetSortOrder( bool ) ) );
83 connect ( m_ablabel, SIGNAL( signalOkPressed(void) ), 86 connect ( m_ablabel, SIGNAL( signalOkPressed(void) ),
84 this, SLOT( slotSwitch(void) ) ); 87 this, SLOT( slotSwitch(void) ) );
85 88
86 load(); 89 load();
87} 90}
88 91
@@ -158,21 +161,21 @@ void AbView::load()
158 emit signalClearLetterPicker(); 161 emit signalClearLetterPicker();
159 162
160 odebug << "selected Category: " << m_curr_category << oendl; 163 odebug << "selected Category: " << m_curr_category << oendl;
161 164
162 if ( m_curr_category == -1 ) { 165 if ( m_curr_category == -1 ) {
163 // Show just unfiled contacts 166 // Show just unfiled contacts
164 m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName, 167 m_list = m_contactdb->sorted( m_sortOrder, Opie::OPimContactAccess::SortFileAsName,
165 Opie::OPimContactAccess::DoNotShowWithCategory, 0 ); 168 Opie::OPimContactAccess::DoNotShowWithCategory, 0 );
166 } elseif ( m_curr_category == 0 ){ 169 } elseif ( m_curr_category == 0 ){
167 // Just show all contacts 170 // Just show all contacts
168 m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName, 171 m_list = m_contactdb->sorted( m_sortOrder, Opie::OPimContactAccess::SortFileAsName,
169 Opie::OPimBase::FilterOff, 0 ); 172 Opie::OPimBase::FilterOff, 0 );
170 } else { 173 } else {
171 // Show contacts with given categories 174 // Show contacts with given categories
172 m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName, 175 m_list = m_contactdb->sorted( m_sortOrder, Opie::OPimContactAccess::SortFileAsName,
173 Opie::OPimBase::FilterCategory, m_curr_category ); 176 Opie::OPimBase::FilterCategory, m_curr_category );
174 } 177 }
175 178
176 odebug << "Number of contacts: " << m_list.count() << oendl; 179 odebug << "Number of contacts: " << m_list.count() << oendl;
177 180
178 updateView( true ); 181 updateView( true );
@@ -413,12 +416,17 @@ void AbView::slotSwitch(){
413 break; 416 break;
414 } 417 }
415 updateView(); 418 updateView();
416 419
417} 420}
418 421
422void AbView::slotSetSortOrder( bool order ){
423 m_sortOrder = order;
424 reload();
425}
426
419// END: Slots 427// END: Slots
420 428
421void AbView::clearForCategory() 429void AbView::clearForCategory()
422{ 430{
423 Opie::OPimContactAccess::List::Iterator it; 431 Opie::OPimContactAccess::List::Iterator it;
424 // Now remove all contacts with wrong category if any category selected 432 // Now remove all contacts with wrong category if any category selected
diff --git a/core/pim/addressbook/abview.h b/core/pim/addressbook/abview.h
index b8c8a08..07b6b28 100644
--- a/core/pim/addressbook/abview.h
+++ b/core/pim/addressbook/abview.h
@@ -55,24 +55,26 @@ signals:
55 void signalViewSwitched ( int ); 55 void signalViewSwitched ( int );
56 56
57public slots: 57public slots:
58 void slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, 58 void slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
59 bool backwards, QString category = QString::null ); 59 bool backwards, QString category = QString::null );
60 void slotSwitch(); 60 void slotSwitch();
61 void slotSetSortOrder( bool order );
61 62
62private: 63private:
63 void updateListinViews(); 64 void updateListinViews();
64 void updateView( bool newdata = false ); 65 void updateView( bool newdata = false );
65 void clearForCategory(); 66 void clearForCategory();
66 bool contactCompare( const Opie::OPimContact &cnt, int category ); 67 bool contactCompare( const Opie::OPimContact &cnt, int category );
67 void parseName( const QString& name, QString *first, QString *middle, 68 void parseName( const QString& name, QString *first, QString *middle,
68 QString * last ); 69 QString * last );
69 70
70 Categories mCat; 71 Categories mCat;
71 bool m_inSearch; 72 bool m_inSearch;
72 bool m_inPersonal; 73 bool m_inPersonal;
74 bool m_sortOrder;
73 int m_curr_category; 75 int m_curr_category;
74 Views m_curr_View; 76 Views m_curr_View;
75 Views m_prev_View; 77 Views m_prev_View;
76 int m_curr_Contact; 78 int m_curr_Contact;
77 79
78 Opie::OPimContactAccess* m_contactdb; 80 Opie::OPimContactAccess* m_contactdb;
diff --git a/core/pim/addressbook/version.h b/core/pim/addressbook/version.h
index 7ce9752..8aafc85 100644
--- a/core/pim/addressbook/version.h
+++ b/core/pim/addressbook/version.h
@@ -1,10 +1,10 @@
1#ifndef _VERSION_H_ 1#ifndef _VERSION_H_
2#define _VERSION_H_ 2#define _VERSION_H_
3 3
4#define MAINVERSION "1" 4#define MAINVERSION "1"
5#define SUBVERSION "1" 5#define SUBVERSION "2"
6#define PATCHVERSION "1" 6#define PATCHVERSION "0"
7 7
8#define APPNAME "OPIE_ADDRESSBOOK" 8#define APPNAME "OPIE_ADDRESSBOOK"
9 9
10#endif 10#endif