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.h140
1 files changed, 140 insertions, 0 deletions
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h
new file mode 100644
index 0000000..9b96997
--- a/dev/null
+++ b/core/pim/addressbook/abtable.h
@@ -0,0 +1,140 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qt Palmtop Environment.
5**
6** 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** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef ABTABLE_H
22#define ABTABLE_H
23
24#include <qpe/categories.h>
25#include <qpe/contact.h>
26
27#include <qmap.h>
28#include <qtable.h>
29#include <qstringlist.h>
30#include <qcombobox.h>
31
32class AbTableItem : public QTableItem
33{
34public:
35 AbTableItem( QTable *t, EditType et, const QString &s,
36 const QString &secondSortKey);
37 QString entryKey() const;
38 void setEntryKey( const QString & k );
39 virtual int alignment() const;
40 virtual QString key() const;
41 void setItem( const QString &txt, const QString &secondKey );
42
43private:
44 QString sortKey;
45};
46
47class AbPickItem : public QTableItem
48{
49public:
50 AbPickItem( QTable *t );
51
52 QWidget *createEditor() const;
53 void setContentFromEditor( QWidget *w );
54
55private:
56 QGuardedPtr<QComboBox> cb;
57};
58
59class AbTable : public QTable
60{
61 Q_OBJECT
62
63public:
64 AbTable( const QValueList<int> *ordered, QWidget *parent, const char *name=0 );
65 ~AbTable();
66 // NEW
67 void addEntry( const Contact &newContact );
68 Contact currentEntry();
69 void replaceCurrentEntry( const Contact &newContact );
70
71 void init();
72
73 void deleteCurrentEntry();
74 void clear();
75 void clearFindRow() { currFindRow = -2; }
76 void loadFields();
77 void refresh();
78 bool save( const QString &fn );
79 void load( const QString &fn );
80
81 // addresspicker mode
82 void setChoiceNames( const QStringList& list);
83 QStringList choiceNames() const;
84 void setChoiceSelection(int index, const QStringList& list);
85 QStringList choiceSelection(int index) const;
86 void setShowCategory( const QString &c );
87 QString showCategory() const;
88 QStringList categories();
89
90 void show();
91 void setPaintingEnabled( bool e );
92
93public slots:
94 void slotDoFind( const QString &str, bool caseSensitive, bool backwards,
95 int category );
96signals:
97 void empty( bool );
98 void details();
99 void signalNotFound();
100 void signalWrapAround();
101
102protected:
103 virtual void keyPressEvent( QKeyEvent *e );
104
105// int rowHeight( int ) const;
106// int rowPos( int row ) const;
107// virtual int rowAt( int pos ) const;
108
109
110protected slots:
111 void moveTo( char );
112 virtual void columnClicked( int col );
113 void itemClicked(int,int col);
114 void rowHeightChanged( int row );
115
116private:
117 void loadFile( const QString &strFile, bool journalFile );
118 void fitColumns();
119 void resort();
120 void updateJournal( const Contact &contact, Contact::journal_action action,
121 int row = -1 );
122 void insertIntoTable( const Contact &contact, int row );
123 void internalAddEntries( QList<Contact> &list );
124 QString findContactName( const Contact &entry );
125 QString findContactContact( const Contact &entry );
126 void journalFreeReplace( const Contact &cnt, int row );
127 void journalFreeRemove( int row );
128 void realignTable( int );
129 void updateVisible();
130 int lastSortCol;
131 bool asc;
132 QMap<AbTableItem*, Contact> contactList;
133 const QValueList<int> *intFields;
134 int currFindRow;
135 QString showCat;
136 QStringList choicenames;
137 bool enablePainting;
138 Categories mCat;
139};
140#endif // ABTABLE_H