Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

abtable.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de)
00004 **
00005 ** This file is part of Qt Palmtop Environment.
00006 **
00007 ** This file may be distributed and/or modified under the terms of the
00008 ** GNU General Public License version 2 as published by the Free Software
00009 ** Foundation and appearing in the file LICENSE.GPL included in the
00010 ** packaging of this file.
00011 **
00012 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00013 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00014 **
00015 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00016 **
00017 ** Contact info@trolltech.com if any conditions of this licensing are
00018 ** not clear to you.
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 // This is a simple container, storing all contact
00055 // information
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     // Set the contacts shown in the table
00087     void setContacts( const Opie::OPimContactAccess::List& viewList );
00088 
00089     // Set the list for primary contacts
00090     void setOrderedList( const QValueList<int> ordered );
00091 
00092     // Selects a contact of a specific UID
00093     bool selectContact( int UID );
00094 
00095     // Get the current selected entry
00096     Opie::OPimContact currentEntry();
00097 
00098     // Get the UID of the current selected Entry
00099     int currentEntry_UID();
00100 
00101     // QString findContactName( const Opie::OPimContact &entry );
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     // addresspicker mode (What's that ? se)
00113     // void setChoiceNames( const QStringList& list);
00114     // QStringList choiceNames() const;
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 //     int rowHeight( int ) const;
00129 //     int rowPos( int row ) const;
00130 //     virtual int rowAt( int pos ) const;
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     // void insertIntoTable( const Opie::OPimContact &cnt, int row );
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     // QMap<AbTableItem*, Opie::OPimContact> contactList;
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

Generated on Sat Nov 5 16:15:46 2005 for OPIE by  doxygen 1.4.2