summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views/kaddressbooktableview.h
blob: c3cb038dfe32980d07c8343a2057c7a6bcb1652f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef KADDRESSBOOKTABLEVIEW_H
#define KADDRESSBOOKTABLEVIEW_H


#ifndef KAB_EMBEDDED


#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <qwidget.h>
#include <q3listview.h>
#include <qstring.h>
#include <qdialog.h>
#include <q3tabdialog.h>
#include <qstringlist.h>
#include <q3valuelist.h>

#include "undo.h"

#else //KAB_EMBEDDED
#include "views/configuretableviewdialog.h"
#endif //KAB_EMBEDDED

#include "klocale.h"
#include "kaddressbookview.h"
//Added by qt3to4:
#include <Q3VBoxLayout>

class Q3ListViewItem;
class Q3ListBox;
class Q3VBoxLayout;
class KConfig;

class ContactListViewItem;
class ContactListView;


namespace KABC { class AddressBook; }

/**
 * This class is the table view for kaddressbook. This view is a KListView
 * with multiple columns for the selected fields.
 *
 * @short Table View
 * @author Don Sanders <dsanders@kde.org>
 * @version 0.1
 */
class KAddressBookTableView : public KAddressBookView
{
friend class ContactListView;

  Q_OBJECT

  public:
    KAddressBookTableView( KABC::AddressBook *ab, QWidget *parent,
                           const char *name = 0 );
    virtual ~KAddressBookTableView();

    virtual void refresh(QString uid = QString::null);
    virtual QStringList selectedUids();
    virtual void setSelected(QString uid = QString::null, bool selected = false);
    virtual void readConfig(KConfig *config);
    virtual void writeConfig(KConfig *config);
    virtual QString type() const { return "Table"; }
    void doSearch( const QString&  s ,KABC::Field *field );
    virtual void scrollUP();
    virtual void scrollDOWN();
    virtual void setFocusAV();

  public slots:
    virtual void reconstructListView();

  protected slots:
    /** Called whenever the user selects an addressee in the list view.
    */
    void addresseeSelected();
    void addresseeDeleted();

    /** Called whenever the user executes an addressee. In terms of the
    * list view, this is probably a double click
    */
    void addresseeExecuted(Q3ListViewItem*);

  private:
    Q3VBoxLayout *mainLayout;
    ContactListView *mListView;
};


class TableViewFactory : public ViewFactory
{
  public:
    KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name )
    {
      return new KAddressBookTableView( ab, parent, name );
    }

    QString type() const { return "Table"; }

    QString description() const { return i18n( "A listing of contacts in a table. Each cell of "
                                  "the table holds a field of the contact." ); }

    ViewConfigureWidget *configureWidget( KABC::AddressBook *ab, QWidget *parent,
                                          const char *name = 0 )
    {
      return new ConfigureTableViewWidget( ab, parent, name );
    }
};
/*US
extern "C" {
  void *init_libkaddrbk_tableview()
  {
    return ( new TableViewFactory );
  }
}
*/

#endif