summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views
Unidiff
Diffstat (limited to 'kaddressbook/views') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/kaddressbookcardview.cpp5
-rw-r--r--kaddressbook/views/kaddressbookcardview.h1
-rw-r--r--kaddressbook/views/kaddressbookiconview.cpp6
-rw-r--r--kaddressbook/views/kaddressbookiconview.h1
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp6
-rw-r--r--kaddressbook/views/kaddressbooktableview.h1
6 files changed, 20 insertions, 0 deletions
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp
index a7bf6c9..7f33bb4 100644
--- a/kaddressbook/views/kaddressbookcardview.cpp
+++ b/kaddressbook/views/kaddressbookcardview.cpp
@@ -148,49 +148,54 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab,
148{ 148{
149 mShowEmptyFields = false; 149 mShowEmptyFields = false;
150 150
151 // Init the GUI 151 // Init the GUI
152 QVBoxLayout *layout = new QVBoxLayout(viewWidget()); 152 QVBoxLayout *layout = new QVBoxLayout(viewWidget());
153 153
154 mCardView = new AddresseeCardView(viewWidget(), "mCardView"); 154 mCardView = new AddresseeCardView(viewWidget(), "mCardView");
155 mCardView->setSelectionMode(CardView::Extended); 155 mCardView->setSelectionMode(CardView::Extended);
156 layout->addWidget(mCardView); 156 layout->addWidget(mCardView);
157 157
158 // Connect up the signals 158 // Connect up the signals
159 connect(mCardView, SIGNAL(executed(CardViewItem *)), 159 connect(mCardView, SIGNAL(executed(CardViewItem *)),
160 this, SLOT(addresseeExecuted(CardViewItem *))); 160 this, SLOT(addresseeExecuted(CardViewItem *)));
161 connect(mCardView, SIGNAL(selectionChanged()), 161 connect(mCardView, SIGNAL(selectionChanged()),
162 this, SLOT(addresseeSelected())); 162 this, SLOT(addresseeSelected()));
163 connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), 163 connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)),
164 this, SIGNAL(dropped(QDropEvent*))); 164 this, SIGNAL(dropped(QDropEvent*)));
165 connect(mCardView, SIGNAL(startAddresseeDrag()), 165 connect(mCardView, SIGNAL(startAddresseeDrag()),
166 this, SIGNAL(startDrag())); 166 this, SIGNAL(startDrag()));
167} 167}
168 168
169KAddressBookCardView::~KAddressBookCardView() 169KAddressBookCardView::~KAddressBookCardView()
170{ 170{
171} 171}
172void KAddressBookCardView::setFocusAV()
173{
174 if ( mCardView )
175 mCardView->setFocus();
172 176
177}
173void KAddressBookCardView::scrollUP() 178void KAddressBookCardView::scrollUP()
174{ 179{
175 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); 180 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
176 QApplication::postEvent( mCardView, ev ); 181 QApplication::postEvent( mCardView, ev );
177 182
178} 183}
179void KAddressBookCardView::scrollDOWN() 184void KAddressBookCardView::scrollDOWN()
180{ 185{
181 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); 186 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
182 QApplication::postEvent( mCardView, ev ); 187 QApplication::postEvent( mCardView, ev );
183} 188}
184void KAddressBookCardView::readConfig(KConfig *config) 189void KAddressBookCardView::readConfig(KConfig *config)
185{ 190{
186 KAddressBookView::readConfig(config); 191 KAddressBookView::readConfig(config);
187 192
188 // costum colors? 193 // costum colors?
189 if ( config->readBoolEntry( "EnableCustomColors", false ) ) 194 if ( config->readBoolEntry( "EnableCustomColors", false ) )
190 { 195 {
191 QPalette p( mCardView->palette() ); 196 QPalette p( mCardView->palette() );
192 QColor c = p.color(QPalette::Normal, QColorGroup::Base ); 197 QColor c = p.color(QPalette::Normal, QColorGroup::Base );
193 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); 198 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) );
194 c = p.color(QPalette::Normal, QColorGroup::Text ); 199 c = p.color(QPalette::Normal, QColorGroup::Text );
195 p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); 200 p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) );
196 c = p.color(QPalette::Normal, QColorGroup::Button ); 201 c = p.color(QPalette::Normal, QColorGroup::Button );
diff --git a/kaddressbook/views/kaddressbookcardview.h b/kaddressbook/views/kaddressbookcardview.h
index 45a9781..8f22d54 100644
--- a/kaddressbook/views/kaddressbookcardview.h
+++ b/kaddressbook/views/kaddressbookcardview.h
@@ -41,48 +41,49 @@ class QDropEvent;
41class KConfig; 41class KConfig;
42class AddresseeCardView; 42class AddresseeCardView;
43 43
44/** 44/**
45 This view uses the CardView class to create a card view. At some 45 This view uses the CardView class to create a card view. At some
46 point in the future I think this will be the default view of 46 point in the future I think this will be the default view of
47 KAddressBook. 47 KAddressBook.
48 */ 48 */
49class KAddressBookCardView : public KAddressBookView 49class KAddressBookCardView : public KAddressBookView
50{ 50{
51 Q_OBJECT 51 Q_OBJECT
52 52
53 public: 53 public:
54 KAddressBookCardView( KABC::AddressBook *ab, QWidget *parent, 54 KAddressBookCardView( KABC::AddressBook *ab, QWidget *parent,
55 const char *name = 0 ); 55 const char *name = 0 );
56 virtual ~KAddressBookCardView(); 56 virtual ~KAddressBookCardView();
57 void doSearch( const QString& s,KABC::Field *field ); 57 void doSearch( const QString& s,KABC::Field *field );
58 virtual QStringList selectedUids(); 58 virtual QStringList selectedUids();
59 virtual QString type() const { return "Card"; } 59 virtual QString type() const { return "Card"; }
60 60
61 virtual void readConfig(KConfig *config); 61 virtual void readConfig(KConfig *config);
62 virtual void writeConfig(KConfig *); 62 virtual void writeConfig(KConfig *);
63 virtual void scrollUP(); 63 virtual void scrollUP();
64 virtual void scrollDOWN(); 64 virtual void scrollDOWN();
65 virtual void setFocusAV();
65 66
66 public slots: 67 public slots:
67 void refresh(QString uid = QString::null); 68 void refresh(QString uid = QString::null);
68 void setSelected(QString uid/*US = QString::null*/, bool selected/*US = true*/); 69 void setSelected(QString uid/*US = QString::null*/, bool selected/*US = true*/);
69//US added an additional method without parameter 70//US added an additional method without parameter
70 void setSelected(); 71 void setSelected();
71 72
72 protected slots: 73 protected slots:
73 void addresseeExecuted(CardViewItem *item); 74 void addresseeExecuted(CardViewItem *item);
74 void addresseeSelected(); 75 void addresseeSelected();
75 76
76 private: 77 private:
77 AddresseeCardView *mCardView; 78 AddresseeCardView *mCardView;
78 bool mShowEmptyFields; 79 bool mShowEmptyFields;
79}; 80};
80 81
81class AddresseeCardView : public CardView 82class AddresseeCardView : public CardView
82{ 83{
83 Q_OBJECT 84 Q_OBJECT
84 public: 85 public:
85 AddresseeCardView(QWidget *parent, const char *name = 0); 86 AddresseeCardView(QWidget *parent, const char *name = 0);
86 ~AddresseeCardView(); 87 ~AddresseeCardView();
87 88
88 signals: 89 signals:
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp
index f4c68b8..41c3cb2 100644
--- a/kaddressbook/views/kaddressbookiconview.cpp
+++ b/kaddressbook/views/kaddressbookiconview.cpp
@@ -190,48 +190,54 @@ KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab,
190 QVBoxLayout *layout = new QVBoxLayout(viewWidget()); 190 QVBoxLayout *layout = new QVBoxLayout(viewWidget());
191 191
192 mIconView = new AddresseeIconView(viewWidget(), "mIconView"); 192 mIconView = new AddresseeIconView(viewWidget(), "mIconView");
193 layout->addWidget(mIconView); 193 layout->addWidget(mIconView);
194 194
195 // Connect up the signals 195 // Connect up the signals
196 196
197//US method executed is part of KIconView 197//US method executed is part of KIconView
198//US connect(mIconView, SIGNAL(executed(QIconViewItem *)), 198//US connect(mIconView, SIGNAL(executed(QIconViewItem *)),
199//US this, SLOT(addresseeExecuted(QIconViewItem *))); 199//US this, SLOT(addresseeExecuted(QIconViewItem *)));
200 connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), 200 connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)),
201 this, SLOT(addresseeExecuted(QIconViewItem *))); 201 this, SLOT(addresseeExecuted(QIconViewItem *)));
202 202
203 connect(mIconView, SIGNAL(selectionChanged()), 203 connect(mIconView, SIGNAL(selectionChanged()),
204 this, SLOT(addresseeSelected())); 204 this, SLOT(addresseeSelected()));
205 connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), 205 connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)),
206 this, SIGNAL(dropped(QDropEvent*))); 206 this, SIGNAL(dropped(QDropEvent*)));
207 connect(mIconView, SIGNAL(startAddresseeDrag()), 207 connect(mIconView, SIGNAL(startAddresseeDrag()),
208 this, SIGNAL(startDrag())); 208 this, SIGNAL(startDrag()));
209} 209}
210 210
211KAddressBookIconView::~KAddressBookIconView() 211KAddressBookIconView::~KAddressBookIconView()
212{ 212{
213} 213}
214void KAddressBookIconView::setFocusAV()
215{
216 if ( mIconView )
217 mIconView->setFocus();
218}
219
214 220
215void KAddressBookIconView::scrollUP() 221void KAddressBookIconView::scrollUP()
216{ 222{
217 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); 223 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
218 QApplication::postEvent( mIconView, ev ); 224 QApplication::postEvent( mIconView, ev );
219} 225}
220void KAddressBookIconView::scrollDOWN() 226void KAddressBookIconView::scrollDOWN()
221{ 227{
222 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); 228 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
223 QApplication::postEvent( mIconView, ev ); 229 QApplication::postEvent( mIconView, ev );
224} 230}
225void KAddressBookIconView::readConfig(KConfig *config) 231void KAddressBookIconView::readConfig(KConfig *config)
226{ 232{
227 KAddressBookView::readConfig(config); 233 KAddressBookView::readConfig(config);
228 234
229//US method executed is part of KIconView 235//US method executed is part of KIconView
230//US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), 236//US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)),
231//US this, SLOT(addresseeExecuted(QIconViewItem *))); 237//US this, SLOT(addresseeExecuted(QIconViewItem *)));
232 disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), 238 disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)),
233 this, SLOT(addresseeExecuted(QIconViewItem *))); 239 this, SLOT(addresseeExecuted(QIconViewItem *)));
234 240
235//US method executed is part of KIconView. Use selectionChanged instead 241//US method executed is part of KIconView. Use selectionChanged instead
236/*US 242/*US
237 if (KABPrefs::instance()->mHonorSingleClick) 243 if (KABPrefs::instance()->mHonorSingleClick)
diff --git a/kaddressbook/views/kaddressbookiconview.h b/kaddressbook/views/kaddressbookiconview.h
index acfcd71..b0b9fea 100644
--- a/kaddressbook/views/kaddressbookiconview.h
+++ b/kaddressbook/views/kaddressbookiconview.h
@@ -42,48 +42,49 @@ class QIconDragItem;
42class KAddressBookIconView; 42class KAddressBookIconView;
43 43
44namespace KABC { class AddressBook; } 44namespace KABC { class AddressBook; }
45 45
46/** This is an example kaddressbook view that is implemented using 46/** This is an example kaddressbook view that is implemented using
47* KIconView. This view is not the most useful view, but it displays 47* KIconView. This view is not the most useful view, but it displays
48* how simple implementing a new view can be. 48* how simple implementing a new view can be.
49*/ 49*/
50class KAddressBookIconView : public KAddressBookView 50class KAddressBookIconView : public KAddressBookView
51{ 51{
52 Q_OBJECT 52 Q_OBJECT
53 53
54 public: 54 public:
55 KAddressBookIconView( KABC::AddressBook *ab, QWidget *parent, 55 KAddressBookIconView( KABC::AddressBook *ab, QWidget *parent,
56 const char *name = 0 ); 56 const char *name = 0 );
57 virtual ~KAddressBookIconView(); 57 virtual ~KAddressBookIconView();
58 58
59 virtual QStringList selectedUids(); 59 virtual QStringList selectedUids();
60 virtual QString type() const { return "Icon"; } 60 virtual QString type() const { return "Icon"; }
61 void doSearch( const QString& s ,KABC::Field *field ); 61 void doSearch( const QString& s ,KABC::Field *field );
62 62
63 virtual void readConfig(KConfig *config); 63 virtual void readConfig(KConfig *config);
64 virtual void scrollUP(); 64 virtual void scrollUP();
65 virtual void scrollDOWN(); 65 virtual void scrollDOWN();
66 virtual void setFocusAV();
66 67
67 public slots: 68 public slots:
68 void refresh(QString uid = QString::null); 69 void refresh(QString uid = QString::null);
69#ifndef KAB_EMBEDDED 70#ifndef KAB_EMBEDDED
70//MOC_SKIP_BEGIN 71//MOC_SKIP_BEGIN
71 void setSelected(QString uid = QString::null, bool selected = true); 72 void setSelected(QString uid = QString::null, bool selected = true);
72//MOC_SKIP_END 73//MOC_SKIP_END
73#else //KAB_EMBEDDED 74#else //KAB_EMBEDDED
74//US my MOC do not like default parameters ??? 75//US my MOC do not like default parameters ???
75 void setSelected(QString uid, bool selected); 76 void setSelected(QString uid, bool selected);
76#endif //KAB_EMBEDDED 77#endif //KAB_EMBEDDED
77 78
78 protected slots: 79 protected slots:
79 void addresseeExecuted(QIconViewItem *item); 80 void addresseeExecuted(QIconViewItem *item);
80 void addresseeSelected(); 81 void addresseeSelected();
81 82
82 private: 83 private:
83 AddresseeIconView *mIconView; 84 AddresseeIconView *mIconView;
84 QPtrList<AddresseeIconViewItem> mIconList; 85 QPtrList<AddresseeIconViewItem> mIconList;
85}; 86};
86 87
87 88
88#ifndef KAB_EMBEDDED 89#ifndef KAB_EMBEDDED
89//MOC_SKIP_BEGIN 90//MOC_SKIP_BEGIN
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp
index 2412170..e40eb9e 100644
--- a/kaddressbook/views/kaddressbooktableview.cpp
+++ b/kaddressbook/views/kaddressbooktableview.cpp
@@ -30,48 +30,54 @@
30#include "kabprefs.h" 30#include "kabprefs.h"
31#include "undocmds.h" 31#include "undocmds.h"
32#include "viewmanager.h" 32#include "viewmanager.h"
33 33
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qheader.h> 35#include <qheader.h>
36#include <qregexp.h> 36#include <qregexp.h>
37 37
38#include "kaddressbooktableview.h" 38#include "kaddressbooktableview.h"
39 39
40 40
41KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, 41KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab,
42 QWidget *parent, const char *name ) 42 QWidget *parent, const char *name )
43 : KAddressBookView( ab, parent, name ) 43 : KAddressBookView( ab, parent, name )
44{ 44{
45 mainLayout = new QVBoxLayout( viewWidget(), 2 ); 45 mainLayout = new QVBoxLayout( viewWidget(), 2 );
46 46
47 // The list view will be created when the config is read. 47 // The list view will be created when the config is read.
48 mListView = 0; 48 mListView = 0;
49} 49}
50 50
51KAddressBookTableView::~KAddressBookTableView() 51KAddressBookTableView::~KAddressBookTableView()
52{ 52{
53} 53}
54void KAddressBookTableView::setFocusAV()
55{
56 if ( mListView )
57 mListView->setFocus();
58
59}
54void KAddressBookTableView::scrollUP() 60void KAddressBookTableView::scrollUP()
55{ 61{
56 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); 62 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
57 QApplication::postEvent( mListView, ev ); 63 QApplication::postEvent( mListView, ev );
58} 64}
59void KAddressBookTableView::scrollDOWN() 65void KAddressBookTableView::scrollDOWN()
60{ 66{
61 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); 67 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
62 QApplication::postEvent( mListView, ev ); 68 QApplication::postEvent( mListView, ev );
63} 69}
64void KAddressBookTableView::reconstructListView() 70void KAddressBookTableView::reconstructListView()
65{ 71{
66 if (mListView) 72 if (mListView)
67 { 73 {
68 disconnect(mListView, SIGNAL(selectionChanged()), 74 disconnect(mListView, SIGNAL(selectionChanged()),
69 this, SLOT(addresseeSelected())); 75 this, SLOT(addresseeSelected()));
70 disconnect(mListView, SIGNAL(executed(QListViewItem*)), 76 disconnect(mListView, SIGNAL(executed(QListViewItem*)),
71 this, SLOT(addresseeExecuted(QListViewItem*))); 77 this, SLOT(addresseeExecuted(QListViewItem*)));
72 disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), 78 disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)),
73 this, SLOT(addresseeExecuted(QListViewItem*))); 79 this, SLOT(addresseeExecuted(QListViewItem*)));
74 disconnect(mListView, SIGNAL(startAddresseeDrag()), this, 80 disconnect(mListView, SIGNAL(startAddresseeDrag()), this,
75 SIGNAL(startDrag())); 81 SIGNAL(startDrag()));
76 disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), 82 disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)),
77 this, SLOT(addresseeExecuted(QListViewItem*))); 83 this, SLOT(addresseeExecuted(QListViewItem*)));
diff --git a/kaddressbook/views/kaddressbooktableview.h b/kaddressbook/views/kaddressbooktableview.h
index 865f8d5..38db7b4 100644
--- a/kaddressbook/views/kaddressbooktableview.h
+++ b/kaddressbook/views/kaddressbooktableview.h
@@ -44,48 +44,49 @@ namespace KABC { class AddressBook; }
44 * @short Table View 44 * @short Table View
45 * @author Don Sanders <dsanders@kde.org> 45 * @author Don Sanders <dsanders@kde.org>
46 * @version 0.1 46 * @version 0.1
47 */ 47 */
48class KAddressBookTableView : public KAddressBookView 48class KAddressBookTableView : public KAddressBookView
49{ 49{
50friend class ContactListView; 50friend class ContactListView;
51 51
52 Q_OBJECT 52 Q_OBJECT
53 53
54 public: 54 public:
55 KAddressBookTableView( KABC::AddressBook *ab, QWidget *parent, 55 KAddressBookTableView( KABC::AddressBook *ab, QWidget *parent,
56 const char *name = 0 ); 56 const char *name = 0 );
57 virtual ~KAddressBookTableView(); 57 virtual ~KAddressBookTableView();
58 58
59 virtual void refresh(QString uid = QString::null); 59 virtual void refresh(QString uid = QString::null);
60 virtual QStringList selectedUids(); 60 virtual QStringList selectedUids();
61 virtual void setSelected(QString uid = QString::null, bool selected = false); 61 virtual void setSelected(QString uid = QString::null, bool selected = false);
62 virtual void readConfig(KConfig *config); 62 virtual void readConfig(KConfig *config);
63 virtual void writeConfig(KConfig *config); 63 virtual void writeConfig(KConfig *config);
64 virtual QString type() const { return "Table"; } 64 virtual QString type() const { return "Table"; }
65 void doSearch( const QString& s ,KABC::Field *field ); 65 void doSearch( const QString& s ,KABC::Field *field );
66 virtual void scrollUP(); 66 virtual void scrollUP();
67 virtual void scrollDOWN(); 67 virtual void scrollDOWN();
68 virtual void setFocusAV();
68 69
69 public slots: 70 public slots:
70 virtual void reconstructListView(); 71 virtual void reconstructListView();
71 72
72 protected slots: 73 protected slots:
73 /** Called whenever the user selects an addressee in the list view. 74 /** Called whenever the user selects an addressee in the list view.
74 */ 75 */
75 void addresseeSelected(); 76 void addresseeSelected();
76 void addresseeDeleted(); 77 void addresseeDeleted();
77 78
78 /** Called whenever the user executes an addressee. In terms of the 79 /** Called whenever the user executes an addressee. In terms of the
79 * list view, this is probably a double click 80 * list view, this is probably a double click
80 */ 81 */
81 void addresseeExecuted(QListViewItem*); 82 void addresseeExecuted(QListViewItem*);
82 83
83 private: 84 private:
84 QVBoxLayout *mainLayout; 85 QVBoxLayout *mainLayout;
85 ContactListView *mListView; 86 ContactListView *mListView;
86}; 87};
87 88
88 89
89class TableViewFactory : public ViewFactory 90class TableViewFactory : public ViewFactory
90{ 91{
91 public: 92 public: