00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef ABTABLE_H
00023 #define ABTABLE_H
00024
00025 #include <opie2/opimcontact.h>
00026 #include <opie2/ocontactaccess.h>
00027
00028 #include <qpe/categories.h>
00029
00030 #include <qmap.h>
00031 #include <qtable.h>
00032 #include <qstringlist.h>
00033 #include <qcombobox.h>
00034 #include <qpixmap.h>
00035
00036 #if 0
00037 class AbTableItem : public QTableItem
00038 {
00039 public:
00040 AbTableItem( QTable *t, EditType et, const QString &s,
00041 const QString &secondSortKey);
00042 QString entryKey() const;
00043 void setEntryKey( const QString & k );
00044 virtual int alignment() const;
00045 virtual QString key() const;
00046 void setItem( const QString &txt, const QString &secondKey );
00047
00048 private:
00049 QString sortKey;
00050 };
00051
00052 #endif
00053
00054
00055
00056 class ContactItem
00057 {
00058 public:
00059 QPixmap icon;
00060 QString value;
00061 };
00062
00063 #if 0
00064 class AbPickItem : public QTableItem
00065 {
00066 public:
00067 AbPickItem( QTable *t );
00068
00069 QWidget *createEditor() const;
00070 void setContentFromEditor( QWidget *w );
00071
00072 private:
00073 QGuardedPtr<QComboBox> cb;
00074 };
00075
00076 #endif
00077
00078 class AbTable : public QTable
00079 {
00080 Q_OBJECT
00081
00082 public:
00083 AbTable( const QValueList<int> ordered, QWidget *parent, const char *name=0 );
00084 ~AbTable();
00085
00086
00087 void setContacts( const Opie::OPimContactAccess::List& viewList );
00088
00089
00090 void setOrderedList( const QValueList<int> ordered );
00091
00092
00093 bool selectContact( int UID );
00094
00095
00096 Opie::OPimContact currentEntry();
00097
00098
00099 int currentEntry_UID();
00100
00101
00102
00103 void init();
00104 void clear();
00105 void refresh();
00106
00107 void show();
00108 void setPaintingEnabled( bool e );
00109 void viewportPaintEvent( QPaintEvent* e);
00110 void paintCell(QPainter* p, int row, int col, const QRect&, bool );
00111
00112
00113
00114
00115 void setChoiceSelection( const QValueList<int>& list );
00116 QStringList choiceSelection(int index) const;
00117
00118 signals:
00119 void signalSwitch();
00120 void signalEditor();
00121 void signalKeyDown();
00122 void signalKeyUp();
00123 void signalSortOrderChanged( bool order );
00124
00125 protected:
00126 virtual void keyPressEvent( QKeyEvent *e );
00127
00128
00129
00130
00131
00132
00133 protected slots:
00134 void moveTo( char );
00135 virtual void columnClicked( int col );
00136 void itemClicked(int,int col);
00137 void rowHeightChanged( int row );
00138
00139 private:
00140
00141 ContactItem findContactContact( const Opie::OPimContact &entry, int row );
00142 void fitColumns();
00143 void resizeRows();
00144 void realignTable();
00145 void resort();
00146 void updateVisible();
00147
00148 int lastSortCol;
00149 bool asc;
00150
00151 QValueList<int> intFields;
00152 QStringList choicenames;
00153 bool enablePainting;
00154 bool columnVisible;
00155 int countNested;
00156
00157 Opie::OPimContactAccess::List m_viewList;
00158
00159 };
00160 #endif // ABTABLE_H