summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/abtable.h
Unidiff
Diffstat (limited to 'core/pim/addressbook/abtable.h') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.h87
1 files changed, 31 insertions, 56 deletions
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h
index 35a1e9e..83bd5a7 100644
--- a/core/pim/addressbook/abtable.h
+++ b/core/pim/addressbook/abtable.h
@@ -1,8 +1,9 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de)
3** 4**
4** This file is part of Qt Palmtop Environment. 5** This file is part of Qt Palmtop Environment.
5** 6**
6** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
@@ -20,20 +21,19 @@
20 21
21#ifndef ABTABLE_H 22#ifndef ABTABLE_H
22#define ABTABLE_H 23#define ABTABLE_H
23 24
24#include <qpe/categories.h> 25#include <qpe/categories.h>
25#include <opie/ocontact.h> 26#include <opie/ocontact.h>
27#include <opie/ocontactaccess.h>
26 28
27#include <qmap.h> 29#include <qmap.h>
28#include <qtable.h> 30#include <qtable.h>
29#include <qstringlist.h> 31#include <qstringlist.h>
30#include <qcombobox.h> 32#include <qcombobox.h>
31 33
32#include <opie/ocontactaccess.h>
33
34class AbTableItem : public QTableItem 34class AbTableItem : public QTableItem
35{ 35{
36public: 36public:
37 AbTableItem( QTable *t, EditType et, const QString &s, 37 AbTableItem( QTable *t, EditType et, const QString &s,
38 const QString &secondSortKey); 38 const QString &secondSortKey);
39 QString entryKey() const; 39 QString entryKey() const;
@@ -60,60 +60,46 @@ private:
60 60
61class AbTable : public QTable 61class AbTable : public QTable
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64 64
65public: 65public:
66 AbTable( const QValueList<int> *ordered, QWidget *parent, const char *name=0 ); 66 AbTable( const QValueList<int> ordered, QWidget *parent, const char *name=0 );
67 ~AbTable(); 67 ~AbTable();
68 // NEW 68
69 void addEntry( const OContact &newContact ); 69 // Set the contacts shown in the table
70 void setContacts( const OContactAccess::List& viewList );
71 // Selects a contact of a specific UID
72 bool selectContact( int UID );
73
74 // Get the current selected entry
70 OContact currentEntry(); 75 OContact currentEntry();
71 void replaceCurrentEntry( const OContact &newContact );
72 76
73 void init(); 77 // Get the UID of the current selected Entry
78 int currentEntry_UID();
79
80 QString findContactName( const OContact &entry );
74 81
75 void deleteCurrentEntry(); 82 void init();
76 void clear(); 83 void clear();
77 void clearFindRow() { currFindRow = -1; }
78 void loadFields();
79 void refresh(); 84 void refresh();
80 bool save();
81 void load();
82 void reload();
83
84 // addresspicker mode
85 void setChoiceNames( const QStringList& list);
86 QStringList choiceNames() const;
87 void setChoiceSelection(int index, const QStringList& list);
88 QStringList choiceSelection(int index) const;
89 void setShowCategory( const QString &b, const QString &c );
90 void setShowByLetter( char c );
91 QString showCategory() const;
92 QStringList categories();
93
94 void resizeRows();
95 85
96 void show(); 86 void show();
97 void setPaintingEnabled( bool e ); 87 void setPaintingEnabled( bool e );
98 88
99 QString showBook() const; 89 // addresspicker mode (What's that ? se)
100 90 void setChoiceNames( const QStringList& list);
101 void inSearch() { m_inSearch = true; } 91 QStringList choiceNames() const;
102 void offSearch() { m_inSearch = false; } 92 void setChoiceSelection( const QValueList<int>& list );
93 QStringList choiceSelection(int index) const;
103 94
104public slots:
105 void slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, bool backwards,
106 QString category = QString::null );
107signals: 95signals:
108 void empty( bool ); 96 void signalSwitch();
109 void details(); 97 void signalEditor();
110 void signalNotFound(); 98 void signalKeyDown();
111 void signalWrapAround(); 99 void signalKeyUp();
112 void signalSearchBackward(); // Signalled if backward search is requested
113 void signalSearchNext(); // Singalled if forward search is requested
114 100
115protected: 101protected:
116 virtual void keyPressEvent( QKeyEvent *e ); 102 virtual void keyPressEvent( QKeyEvent *e );
117 103
118// int rowHeight( int ) const; 104// int rowHeight( int ) const;
119// int rowPos( int row ) const; 105// int rowPos( int row ) const;
@@ -124,38 +110,27 @@ protected slots:
124 void moveTo( char ); 110 void moveTo( char );
125 virtual void columnClicked( int col ); 111 virtual void columnClicked( int col );
126 void itemClicked(int,int col); 112 void itemClicked(int,int col);
127 void rowHeightChanged( int row ); 113 void rowHeightChanged( int row );
128 114
129private: 115private:
130 void loadFile( const QString &strFile, bool journalFile ); 116 void insertIntoTable( const OContact &cnt, int row );
117 QString findContactContact( const OContact &entry, int row );
131 void fitColumns(); 118 void fitColumns();
119 void resizeRows();
120 void realignTable();
132 void resort(); 121 void resort();
133 void updateJournal( const OContact &contact, OContact::journal_action action,
134 int row = -1 );
135 void insertIntoTable( const OContact &contact, int row );
136 QString findContactName( const OContact &entry );
137 QString findContactContact( const OContact &entry, int row );
138 void journalFreeReplace( const OContact &cnt, int row );
139 void journalFreeRemove( int row );
140 void realignTable( int );
141 void updateVisible(); 122 void updateVisible();
123
142 int lastSortCol; 124 int lastSortCol;
143 bool asc; 125 bool asc;
144 char showChar;
145 QMap<AbTableItem*, OContact> contactList; 126 QMap<AbTableItem*, OContact> contactList;
146 const QValueList<int> *intFields; 127 QValueList<int> intFields;
147 int currFindRow;
148 QString showCat;
149 QStringList choicenames; 128 QStringList choicenames;
150 bool enablePainting; 129 bool enablePainting;
151 Categories mCat;
152 130
153 QString showBk;
154 bool columnVisible; 131 bool columnVisible;
155 132
156 bool m_inSearch; 133 OContactAccess::List m_viewList;
157
158 OContactAccess m_contactdb;
159 134
160}; 135};
161#endif // ABTABLE_H 136#endif // ABTABLE_H