author | drw <drw> | 2005-02-06 23:12:25 (UTC) |
---|---|---|
committer | drw <drw> | 2005-02-06 23:12:25 (UTC) |
commit | 5652634e4ff03370564925ce0856b260c001dc0f (patch) (unidiff) | |
tree | 614cbdec8ff9f4f674a9cb4e5caf44cce1def4f8 | |
parent | 266d71ee80151b3c97671acc95275aa65b682388 (diff) | |
download | opie-5652634e4ff03370564925ce0856b260c001dc0f.zip opie-5652634e4ff03370564925ce0856b260c001dc0f.tar.gz opie-5652634e4ff03370564925ce0856b260c001dc0f.tar.bz2 |
Convert to OPimMainWindow and UI tweaks. There is still a couple items yet to do...
-rw-r--r-- | core/pim/addressbook/abconfig.cpp | 22 | ||||
-rw-r--r-- | core/pim/addressbook/abconfig.h | 13 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 654 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.h | 52 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 62 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 6 |
6 files changed, 310 insertions, 499 deletions
diff --git a/core/pim/addressbook/abconfig.cpp b/core/pim/addressbook/abconfig.cpp index a3fd222..2583327 100644 --- a/core/pim/addressbook/abconfig.cpp +++ b/core/pim/addressbook/abconfig.cpp | |||
@@ -18,9 +18,9 @@ AbConfig::AbConfig( ): | |||
18 | } | 18 | } |
19 | 19 | ||
20 | AbConfig::~AbConfig() | 20 | AbConfig::~AbConfig() |
21 | { | 21 | { |
22 | } | 22 | } |
23 | 23 | ||
24 | bool AbConfig::useRegExp() const | 24 | bool AbConfig::useRegExp() const |
25 | { | 25 | { |
26 | return m_useRegExp; | 26 | return m_useRegExp; |
@@ -65,8 +65,13 @@ AbConfig::LPSearchMode AbConfig::letterPickerSearch() const | |||
65 | { | 65 | { |
66 | return ( AbConfig::LPSearchMode ) m_lpSearchMode; | 66 | return ( AbConfig::LPSearchMode ) m_lpSearchMode; |
67 | } | 67 | } |
68 | 68 | ||
69 | const QString &AbConfig::category() const | ||
70 | { | ||
71 | return m_category; | ||
72 | } | ||
73 | |||
69 | void AbConfig::setUseRegExp( bool v ) | 74 | void AbConfig::setUseRegExp( bool v ) |
70 | { | 75 | { |
71 | m_useRegExp = v ; | 76 | m_useRegExp = v ; |
72 | m_changed = true; | 77 | m_changed = true; |
@@ -120,13 +125,21 @@ void AbConfig::setLetterPickerSearch( const AbConfig::LPSearchMode mode ) | |||
120 | m_lpSearchMode = mode; | 125 | m_lpSearchMode = mode; |
121 | m_changed = true; | 126 | m_changed = true; |
122 | } | 127 | } |
123 | 128 | ||
129 | void AbConfig::setCategory( const QString &cat ) | ||
130 | { | ||
131 | m_category = cat; | ||
132 | } | ||
133 | |||
124 | void AbConfig::load() | 134 | void AbConfig::load() |
125 | { | 135 | { |
126 | // Read Config settings | 136 | // Read Config settings |
127 | Config cfg("AddressBook"); | 137 | Config cfg("AddressBook"); |
128 | 138 | ||
139 | cfg.setGroup( "View" ); | ||
140 | m_category = cfg.readEntry( "Category", "All" ); | ||
141 | |||
129 | cfg.setGroup("Font"); | 142 | cfg.setGroup("Font"); |
130 | m_fontSize = cfg.readNumEntry( "fontSize", 1 ); | 143 | m_fontSize = cfg.readNumEntry( "fontSize", 1 ); |
131 | 144 | ||
132 | cfg.setGroup("Search"); | 145 | cfg.setGroup("Search"); |
@@ -165,8 +178,11 @@ void AbConfig::load() | |||
165 | void AbConfig::save() | 178 | void AbConfig::save() |
166 | { | 179 | { |
167 | if ( m_changed ){ | 180 | if ( m_changed ){ |
168 | Config cfg("AddressBook"); | 181 | Config cfg("AddressBook"); |
182 | cfg.setGroup( "View" ); | ||
183 | cfg.writeEntry( "Category", m_category ); | ||
184 | |||
169 | cfg.setGroup("Font"); | 185 | cfg.setGroup("Font"); |
170 | cfg.writeEntry("fontSize", m_fontSize); | 186 | cfg.writeEntry("fontSize", m_fontSize); |
171 | 187 | ||
172 | cfg.setGroup("Search"); | 188 | cfg.setGroup("Search"); |
@@ -192,11 +208,11 @@ void AbConfig::save() | |||
192 | cfg.writeEntry( "AppName", APPNAME + QString(" V" ) + MAINVERSION + QString(".") + SUBVERSION + QString(".") + PATCHVERSION); | 208 | cfg.writeEntry( "AppName", APPNAME + QString(" V" ) + MAINVERSION + QString(".") + SUBVERSION + QString(".") + PATCHVERSION); |
193 | cfg.writeEntry( "Mainversion", MAINVERSION ); | 209 | cfg.writeEntry( "Mainversion", MAINVERSION ); |
194 | cfg.writeEntry( "SubVersion", SUBVERSION ); | 210 | cfg.writeEntry( "SubVersion", SUBVERSION ); |
195 | cfg.writeEntry( "PatchVersion", PATCHVERSION ); | 211 | cfg.writeEntry( "PatchVersion", PATCHVERSION ); |
196 | 212 | ||
197 | } | 213 | } |
198 | 214 | ||
199 | } | 215 | } |
200 | 216 | ||
201 | void AbConfig::operator= ( const AbConfig& cnf ) | 217 | void AbConfig::operator= ( const AbConfig& cnf ) |
202 | { | 218 | { |
diff --git a/core/pim/addressbook/abconfig.h b/core/pim/addressbook/abconfig.h index c312179..68d087c 100644 --- a/core/pim/addressbook/abconfig.h +++ b/core/pim/addressbook/abconfig.h | |||
@@ -1,8 +1,8 @@ | |||
1 | #ifndef _ABCONFIG_H_ | 1 | #ifndef _ABCONFIG_H_ |
2 | #define _ABCONFIG_H_ | 2 | #define _ABCONFIG_H_ |
3 | 3 | ||
4 | #include <qstringlist.h> | 4 | #include <qstringlist.h> |
5 | #include <qmainwindow.h> | 5 | #include <qmainwindow.h> |
6 | 6 | ||
7 | class AbConfig | 7 | class AbConfig |
8 | { | 8 | { |
@@ -16,9 +16,9 @@ public: | |||
16 | 16 | ||
17 | 17 | ||
18 | AbConfig(); | 18 | AbConfig(); |
19 | ~AbConfig(); | 19 | ~AbConfig(); |
20 | 20 | ||
21 | // Search Settings | 21 | // Search Settings |
22 | bool useRegExp() const; | 22 | bool useRegExp() const; |
23 | bool useWildCards() const; | 23 | bool useWildCards() const; |
24 | bool beCaseSensitive() const; | 24 | bool beCaseSensitive() const; |
@@ -28,19 +28,21 @@ public: | |||
28 | QValueList<int> orderList() const; | 28 | QValueList<int> orderList() const; |
29 | QMainWindow::ToolBarDock getToolBarPos() const; | 29 | QMainWindow::ToolBarDock getToolBarPos() const; |
30 | bool fixedBars() const; | 30 | bool fixedBars() const; |
31 | LPSearchMode letterPickerSearch() const; | 31 | LPSearchMode letterPickerSearch() const; |
32 | 32 | const QString &category() const; | |
33 | |||
33 | void setUseRegExp( bool v ); | 34 | void setUseRegExp( bool v ); |
34 | void setUseWildCards( bool v ); | 35 | void setUseWildCards( bool v ); |
35 | void setBeCaseSensitive( bool v ); | 36 | void setBeCaseSensitive( bool v ); |
36 | void setUseQtMail( bool v ); | 37 | void setUseQtMail( bool v ); |
37 | void setUseOpieMail( bool v ); | 38 | void setUseOpieMail( bool v ); |
38 | void setFontSize( int v ); | 39 | void setFontSize( int v ); |
39 | void setOrderList( const QValueList<int>& list ); | 40 | void setOrderList( const QValueList<int>& list ); |
40 | void setToolBarDock( const QMainWindow::ToolBarDock v ); | 41 | void setToolBarDock( const QMainWindow::ToolBarDock v ); |
41 | void setFixedBars( const bool fixed ); | 42 | void setFixedBars( const bool fixed ); |
42 | void setLetterPickerSearch( const LPSearchMode mode ); | 43 | void setLetterPickerSearch( const LPSearchMode mode ); |
44 | void setCategory( const QString &cat ); | ||
43 | 45 | ||
44 | void operator= ( const AbConfig& cnf ); | 46 | void operator= ( const AbConfig& cnf ); |
45 | 47 | ||
46 | void load(); | 48 | void load(); |
@@ -54,14 +56,15 @@ protected: | |||
54 | 56 | ||
55 | bool m_useQtMail; | 57 | bool m_useQtMail; |
56 | bool m_useOpieMail; | 58 | bool m_useOpieMail; |
57 | bool m_useRegExp; | 59 | bool m_useRegExp; |
58 | bool m_beCaseSensitive; | 60 | bool m_beCaseSensitive; |
59 | int m_fontSize; | 61 | int m_fontSize; |
60 | QValueList<int> m_ordered; | 62 | QValueList<int> m_ordered; |
61 | int m_barPos; | 63 | int m_barPos; |
62 | bool m_fixedBars; | 64 | bool m_fixedBars; |
63 | int m_lpSearchMode; | 65 | int m_lpSearchMode; |
66 | QString m_category; | ||
64 | 67 | ||
65 | bool m_changed; | 68 | bool m_changed; |
66 | }; | 69 | }; |
67 | 70 | ||
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 3f0ac74..a4c2c6e 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -53,235 +53,102 @@ | |||
53 | 53 | ||
54 | extern QString addressbookPersonalVCardName(); | 54 | extern QString addressbookPersonalVCardName(); |
55 | 55 | ||
56 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | 56 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, |
57 | WFlags f ) | 57 | WFlags /*f*/ ) |
58 | : QMainWindow( parent, name, f ), | 58 | : Opie::OPimMainWindow( "Addressbook", "Contacts", tr( "Contact" ), "AddressBook", |
59 | catMenu (0l), | 59 | parent, name, WType_TopLevel | WStyle_ContextHelp ), |
60 | abEditor(0l), | 60 | abEditor(0l), |
61 | syncing(FALSE), | 61 | syncing(false) |
62 | m_tableViewButton(0l), | ||
63 | m_cardViewButton(0l) | ||
64 | { | 62 | { |
63 | setCaption( tr( "Contacts" ) ); | ||
64 | |||
65 | isLoading = true; | 65 | isLoading = true; |
66 | 66 | ||
67 | m_config.load(); | 67 | m_config.load(); |
68 | 68 | ||
69 | setCaption( tr("Contacts") ); | 69 | // Create Views |
70 | setIcon( Resource::loadPixmap( "addressbook/AddressBook" ) ); | 70 | m_listContainer = new QWidget( this ); |
71 | 71 | QVBoxLayout *vb = new QVBoxLayout( m_listContainer ); | |
72 | // Settings for Main Menu | ||
73 | // setToolBarsMovable( false ); | ||
74 | setToolBarsMovable( !m_config.fixedBars() ); | ||
75 | setRightJustification( true ); | ||
76 | |||
77 | QToolBar *bar = new QToolBar( this ); | ||
78 | bar->setHorizontalStretchable( TRUE ); | ||
79 | |||
80 | QMenuBar *mbList = new QMenuBar( bar ); | ||
81 | mbList->setMargin( 0 ); | ||
82 | |||
83 | QPopupMenu *edit = new QPopupMenu( mbList ); | ||
84 | mbList->insertItem( tr( "Contact" ), edit ); | ||
85 | |||
86 | // Category Menu | ||
87 | catMenu = new QPopupMenu( this ); | ||
88 | catMenu->setCheckable( TRUE ); | ||
89 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | ||
90 | mbList->insertItem( tr("View"), catMenu ); | ||
91 | |||
92 | // Create Toolbar | ||
93 | listTools = new QToolBar( this, "list operations" ); | ||
94 | listTools->setHorizontalStretchable( true ); | ||
95 | addToolBar( listTools ); | ||
96 | moveToolBar( listTools, m_config.getToolBarPos() ); | ||
97 | |||
98 | // View Icons | ||
99 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/listview" ), | ||
100 | QString::null, 0, this, 0 ); | ||
101 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); | ||
102 | m_tableViewButton->setToggleAction( true ); | ||
103 | m_tableViewButton->addTo( listTools ); | ||
104 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "addressbook/cardview" ), QString::null, 0, this, 0 ); | ||
105 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); | ||
106 | m_cardViewButton->setToggleAction( true ); | ||
107 | m_cardViewButton->addTo( listTools ); | ||
108 | |||
109 | listTools->addSeparator(); | ||
110 | |||
111 | // Other Buttons | ||
112 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, | ||
113 | 0, this, 0 ); | ||
114 | actionNew = a; | ||
115 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); | ||
116 | a->addTo( edit ); | ||
117 | a->addTo( listTools ); | ||
118 | |||
119 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | ||
120 | 0, this, 0 ); | ||
121 | actionEdit = a; | ||
122 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); | ||
123 | a->addTo( edit ); | ||
124 | a->addTo( listTools ); | ||
125 | |||
126 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | ||
127 | 0, this, 0 ); | ||
128 | actionTrash = a; | ||
129 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); | ||
130 | a->addTo( edit ); | ||
131 | a->addTo( listTools ); | ||
132 | |||
133 | |||
134 | // make it possible to go directly to businesscard via qcop call | ||
135 | //#if defined(Q_WS_QWS) // Why this ? (se) | ||
136 | #if !defined(QT_NO_COP) | ||
137 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); | ||
138 | connect (addressChannel, SIGNAL( received(const QCString&,const QByteArray&)), | ||
139 | this, SLOT ( appMessage(const QCString&,const QByteArray&) ) ); | ||
140 | #endif | ||
141 | // #endif | ||
142 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), | ||
143 | QString::null, 0, this, 0 ); | ||
144 | actionFind = a; | ||
145 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); | ||
146 | a->addTo( edit ); | ||
147 | a->addTo( listTools ); | ||
148 | |||
149 | // Much better search widget, taken from QTReader.. (se) | ||
150 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); | ||
151 | searchBar->setHorizontalStretchable( TRUE ); | ||
152 | searchBar->hide(); | ||
153 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | ||
154 | |||
155 | // QFont f("unifont", 16 /*, QFont::Bold*/); | ||
156 | // searchEdit->setFont( f ); | ||
157 | |||
158 | searchBar->setStretchableWidget( searchEdit ); | ||
159 | connect( searchEdit, SIGNAL( returnPressed() ), | ||
160 | this, SLOT( slotFind() ) ); | ||
161 | |||
162 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | ||
163 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | ||
164 | a->addTo( searchBar ); | ||
165 | |||
166 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | ||
167 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); | ||
168 | a->addTo( searchBar ); | ||
169 | |||
170 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), | ||
171 | QString::null, 0, this, 0 ); | ||
172 | //a->setEnabled( FALSE ); we got support for it now :) zecke | ||
173 | actionMail = a; | ||
174 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | ||
175 | a->addTo( edit ); | ||
176 | a->addTo( listTools ); | ||
177 | |||
178 | if ( Ir::supported() ) { | ||
179 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | ||
180 | 0, this, 0 ); | ||
181 | actionBeam = a; | ||
182 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | ||
183 | a->addTo( edit ); | ||
184 | a->addTo( listTools ); | ||
185 | } | ||
186 | 72 | ||
187 | edit->insertSeparator(); | 73 | m_abView = new AbView( m_listContainer, m_config.orderList() ); |
74 | vb->addWidget( m_abView ); | ||
75 | connect( m_abView, SIGNAL(signalViewSwitched(int)), | ||
76 | this, SLOT(slotViewSwitched(int)) ); | ||
188 | 77 | ||
189 | a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null, | 78 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); |
190 | 0, this, 0); | ||
191 | actionPersonal = a; | ||
192 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); | ||
193 | a->addTo( edit ); | ||
194 | 79 | ||
195 | a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), QString::null, | 80 | // Letter Picker |
196 | 0, this, 0); | 81 | pLabel = new LetterPicker( m_listContainer ); |
197 | actionPersonal = a; | 82 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
198 | connect( a, SIGNAL( activated() ), this, SLOT( exportvCard() ) ); | 83 | connect(m_abView, SIGNAL(signalClearLetterPicker()), pLabel, SLOT(clear()) ); |
199 | a->addTo( edit ); | ||
200 | 84 | ||
201 | edit->insertSeparator(); | 85 | vb->addWidget( pLabel ); |
202 | 86 | ||
203 | a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), | 87 | // Quick search bar |
204 | QString::null, 0, this, 0 , TRUE ); | 88 | m_searchBar = new OFloatBar( "Search", this, QMainWindow::Top, true ); |
205 | actionPersonal = a; | 89 | m_searchBar->setHorizontalStretchable( true ); |
206 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); | 90 | m_searchBar->hide(); |
207 | a->addTo( edit ); | 91 | m_searchEdit = new QLineEdit( m_searchBar, "m_searchEdit" ); |
208 | 92 | ||
93 | m_searchBar->setStretchableWidget( m_searchEdit ); | ||
94 | connect( m_searchEdit, SIGNAL(returnPressed()), this, SLOT(slotFind()) ); | ||
209 | 95 | ||
210 | #ifdef __DEBUG_RELEASE | 96 | QAction *a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
211 | // Remove this function for public Release ! This is only | 97 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); |
212 | // for debug purposes .. | 98 | a->addTo( m_searchBar ); |
213 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); | ||
214 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); | ||
215 | a->addTo( edit ); | ||
216 | #endif | ||
217 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, | ||
218 | 0, this, 0 ); | ||
219 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); | ||
220 | a->addTo( edit ); | ||
221 | 99 | ||
222 | // Create Views | 100 | // Insert Contact menu items |
223 | listContainer = new QWidget( this ); | 101 | QActionGroup *items = new QActionGroup( this, QString::null, false ); |
224 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | ||
225 | 102 | ||
226 | m_abView = new AbView( listContainer, m_config.orderList() ); | 103 | m_actionMail = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), |
227 | vb->addWidget( m_abView ); | 104 | QString::null, 0, items, 0 ); |
228 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 105 | connect( m_actionMail, SIGNAL(activated()), this, SLOT(writeMail()) ); |
229 | connect( m_abView, SIGNAL( signalViewSwitched(int) ), | ||
230 | this, SLOT( slotViewSwitched(int) ) ); | ||
231 | 106 | ||
107 | a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), | ||
108 | QString::null, 0, items, 0 ); | ||
109 | connect( a, SIGNAL(activated()), this, SLOT(importvCard()) ); | ||
232 | 110 | ||
233 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); | 111 | a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), |
112 | QString::null, 0, items, 0 ); | ||
113 | connect( a, SIGNAL(activated()), this, SLOT(exportvCard()) ); | ||
234 | 114 | ||
235 | // m_abView->load(); // Already done by c'tor . | 115 | m_actionPersonal = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), |
116 | QString::null, 0, items, 0 , true ); | ||
117 | connect( m_actionPersonal, SIGNAL(activated()), this, SLOT(slotPersonalView()) ); | ||
236 | 118 | ||
237 | // Letter Picker | 119 | insertItemMenuItems( items ); |
238 | pLabel = new LetterPicker( listContainer ); | ||
239 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | ||
240 | connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); | ||
241 | 120 | ||
242 | vb->addWidget( pLabel ); | 121 | // Insert View menu items |
122 | items = new QActionGroup( this, QString::null, false ); | ||
123 | |||
124 | a = new QAction( tr("Show quick search bar"),QString::null, 0, items, 0, true ); | ||
125 | connect( a, SIGNAL(toggled(bool)), this, SLOT(slotShowFind(bool)) ); | ||
243 | 126 | ||
244 | // All Categories into view-menu.. | 127 | insertViewMenuItems( items ); |
245 | populateCategories(); | ||
246 | 128 | ||
247 | // Fontsize | 129 | // Fontsize |
248 | defaultFont = new QFont( m_abView->font() ); | 130 | defaultFont = new QFont( m_abView->font() ); |
249 | slotSetFont(m_config.fontSize()); | 131 | slotSetFont(m_config.fontSize()); |
250 | m_curFontSize = m_config.fontSize(); | 132 | m_curFontSize = m_config.fontSize(); |
251 | 133 | ||
252 | setCentralWidget(listContainer); | 134 | setCentralWidget(m_listContainer); |
253 | 135 | ||
254 | //odebug << "adressbook contrsuction: t=" << t.elapsed() << oendl; | 136 | //odebug << "adressbook contrsuction: t=" << t.elapsed() << oendl; |
255 | connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); | 137 | connect( qApp, SIGNAL(flush()), this, SLOT(flush()) ); |
256 | connect( qApp, SIGNAL( reload() ), this, SLOT( reload() ) ); | 138 | connect( qApp, SIGNAL(reload()), this, SLOT(reload()) ); |
257 | connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), | 139 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
258 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); | 140 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); |
259 | |||
260 | 141 | ||
261 | isLoading = false; | 142 | isLoading = false; |
262 | } | ||
263 | 143 | ||
264 | 144 | // Handle category selection | |
265 | void AddressbookWindow::slotConfig() | 145 | setViewCategory( m_config.category() ); |
266 | { | 146 | m_abView->setShowByCategory( m_config.category() ); |
267 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); | 147 | connect( this, SIGNAL(categorySelected(const QString&)), |
268 | dlg -> setConfig( m_config ); | 148 | this, SLOT(slotSetCategory(const QString&)) ); |
269 | if ( QPEApplication::execDialog( dlg ) ) { | ||
270 | odebug << "Config Dialog accepted!" << oendl; | ||
271 | m_config = dlg -> getConfig(); | ||
272 | if ( m_curFontSize != m_config.fontSize() ){ | ||
273 | odebug << "Font was changed!" << oendl; | ||
274 | m_curFontSize = m_config.fontSize(); | ||
275 | emit slotSetFont( m_curFontSize ); | ||
276 | } | ||
277 | m_abView -> setListOrder( m_config.orderList() ); | ||
278 | } | ||
279 | |||
280 | delete dlg; | ||
281 | } | 149 | } |
282 | 150 | ||
283 | |||
284 | void AddressbookWindow::slotSetFont( int size ) | 151 | void AddressbookWindow::slotSetFont( int size ) |
285 | { | 152 | { |
286 | odebug << "void AddressbookWindow::slotSetFont( " << size << " )" << oendl; | 153 | odebug << "void AddressbookWindow::slotSetFont( " << size << " )" << oendl; |
287 | 154 | ||
@@ -353,10 +220,10 @@ void AddressbookWindow::setDocument( const QString &filename ) | |||
353 | odebug << "void AddressbookWindow::setDocument( " << filename << " )" << oendl; | 220 | odebug << "void AddressbookWindow::setDocument( " << filename << " )" << oendl; |
354 | 221 | ||
355 | // Switch to default backend. This should avoid to import into | 222 | // Switch to default backend. This should avoid to import into |
356 | // the personal database accidently. | 223 | // the personal database accidently. |
357 | if ( actionPersonal->isOn() ){ | 224 | if ( m_actionPersonal->isOn() ){ |
358 | actionPersonal->setOn( false ); | 225 | m_actionPersonal->setOn( false ); |
359 | slotPersonalView(); | 226 | slotPersonalView(); |
360 | } | 227 | } |
361 | 228 | ||
362 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ | 229 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ |
@@ -437,15 +304,35 @@ AddressbookWindow::~AddressbookWindow() | |||
437 | m_config.setToolBarDock( dock ); | 304 | m_config.setToolBarDock( dock ); |
438 | m_config.save(); | 305 | m_config.save(); |
439 | } | 306 | } |
440 | 307 | ||
441 | void AddressbookWindow::slotUpdateToolbar() | 308 | int AddressbookWindow::create() |
309 | { | ||
310 | return 0; | ||
311 | } | ||
312 | |||
313 | bool AddressbookWindow::remove( int /*uid*/ ) | ||
314 | { | ||
315 | return false; | ||
316 | } | ||
317 | |||
318 | void AddressbookWindow::beam( int /*uid*/ ) | ||
319 | { | ||
320 | } | ||
321 | |||
322 | void AddressbookWindow::show( int /*uid*/ ) | ||
323 | { | ||
324 | } | ||
325 | |||
326 | void AddressbookWindow::edit( int /*uid*/ ) | ||
442 | { | 327 | { |
443 | Opie::OPimContact ce = m_abView->currentEntry(); | ||
444 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | ||
445 | } | 328 | } |
446 | 329 | ||
447 | void AddressbookWindow::slotListNew() | 330 | void AddressbookWindow::add( const Opie::OPimRecord& ) |
331 | { | ||
332 | } | ||
333 | |||
334 | void AddressbookWindow::slotItemNew() | ||
448 | { | 335 | { |
449 | Opie::OPimContact cnt; | 336 | Opie::OPimContact cnt; |
450 | if( !syncing ) { | 337 | if( !syncing ) { |
451 | editEntry( NewEntry ); | 338 | editEntry( NewEntry ); |
@@ -454,16 +341,27 @@ void AddressbookWindow::slotListNew() | |||
454 | tr("Can not edit data, currently syncing")); | 341 | tr("Can not edit data, currently syncing")); |
455 | } | 342 | } |
456 | } | 343 | } |
457 | 344 | ||
458 | // void AddressbookWindow::slotListView() | 345 | void AddressbookWindow::slotItemEdit() |
459 | // { | 346 | { |
460 | // m_abView -> init( abList->currentEntry() ); | 347 | if(!syncing) { |
461 | // // :SX mView->sync(); | 348 | if (m_actionPersonal->isOn()) { |
462 | // //:SXshowView(); | 349 | editPersonal(); |
463 | // } | 350 | } else { |
351 | editEntry( EditEntry ); | ||
352 | } | ||
353 | } else { | ||
354 | QMessageBox::warning( this, tr("Contacts"), | ||
355 | tr("Can not edit data, currently syncing") ); | ||
356 | } | ||
357 | } | ||
358 | |||
359 | void AddressbookWindow::slotItemDuplicate() | ||
360 | { | ||
361 | } | ||
464 | 362 | ||
465 | void AddressbookWindow::slotListDelete() | 363 | void AddressbookWindow::slotItemDelete() |
466 | { | 364 | { |
467 | if(!syncing) { | 365 | if(!syncing) { |
468 | Opie::OPimContact tmpEntry = m_abView ->currentEntry(); | 366 | Opie::OPimContact tmpEntry = m_abView ->currentEntry(); |
469 | 367 | ||
@@ -485,27 +383,92 @@ void AddressbookWindow::slotListDelete() | |||
485 | tr("Can not edit data, currently syncing") ); | 383 | tr("Can not edit data, currently syncing") ); |
486 | } | 384 | } |
487 | } | 385 | } |
488 | 386 | ||
489 | void AddressbookWindow::slotFindOpen() | 387 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
388 | |||
389 | void AddressbookWindow::slotItemBeam() | ||
490 | { | 390 | { |
491 | searchBar->show(); | 391 | QString beamFilename; |
492 | m_abView -> inSearch(); | 392 | Opie::OPimContact c; |
493 | searchEdit->setFocus(); | 393 | if ( m_actionPersonal->isOn() ) { |
394 | beamFilename = addressbookPersonalVCardName(); | ||
395 | if ( !QFile::exists( beamFilename ) ) | ||
396 | return; // can't beam a non-existent file | ||
397 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | ||
398 | beamFilename ); | ||
399 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | ||
400 | Opie::OPimContactAccess::List allList = access->allRecords(); | ||
401 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | ||
402 | c = *it; | ||
403 | |||
404 | delete access; | ||
405 | } else { | ||
406 | unlink( beamfile ); // delete if exists | ||
407 | mkdir("/tmp/obex/", 0755); | ||
408 | c = m_abView -> currentEntry(); | ||
409 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | ||
410 | beamfile ); | ||
411 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | ||
412 | access->add( c ); | ||
413 | access->save(); | ||
414 | delete access; | ||
415 | |||
416 | beamFilename = beamfile; | ||
417 | } | ||
418 | |||
419 | odebug << "Beaming: " << beamFilename << oendl; | ||
420 | |||
421 | Ir *ir = new Ir( this ); | ||
422 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | ||
423 | QString description = c.fullName(); | ||
424 | ir->send( beamFilename, description, "text/x-vCard" ); | ||
494 | } | 425 | } |
495 | void AddressbookWindow::slotFindClose() | 426 | |
427 | void AddressbookWindow::slotItemFind() | ||
496 | { | 428 | { |
497 | searchBar->hide(); | ||
498 | m_abView -> offSearch(); | ||
499 | // m_abView->setFocus(); | ||
500 | } | 429 | } |
501 | 430 | ||
431 | void AddressbookWindow::slotConfigure() | ||
432 | { | ||
433 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); | ||
434 | dlg -> setConfig( m_config ); | ||
435 | if ( QPEApplication::execDialog( dlg ) ) { | ||
436 | odebug << "Config Dialog accepted!" << oendl; | ||
437 | m_config = dlg -> getConfig(); | ||
438 | if ( m_curFontSize != m_config.fontSize() ){ | ||
439 | odebug << "Font was changed!" << oendl; | ||
440 | m_curFontSize = m_config.fontSize(); | ||
441 | emit slotSetFont( m_curFontSize ); | ||
442 | } | ||
443 | m_abView -> setListOrder( m_config.orderList() ); | ||
444 | } | ||
445 | |||
446 | delete dlg; | ||
447 | } | ||
448 | |||
449 | void AddressbookWindow::slotShowFind( bool show ) | ||
450 | { | ||
451 | if ( show ) | ||
452 | { | ||
453 | // Display search bar | ||
454 | m_searchBar->show(); | ||
455 | m_abView -> inSearch(); | ||
456 | m_searchEdit->setFocus(); | ||
457 | } | ||
458 | else | ||
459 | { | ||
460 | // Hide search bar | ||
461 | m_searchBar->hide(); | ||
462 | m_abView -> offSearch(); | ||
463 | } | ||
464 | } | ||
502 | 465 | ||
503 | void AddressbookWindow::slotFind() | 466 | void AddressbookWindow::slotFind() |
504 | { | 467 | { |
505 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); | 468 | m_abView->slotDoFind( m_searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); |
506 | 469 | ||
507 | searchEdit->clearFocus(); | 470 | m_searchEdit->clearFocus(); |
508 | // m_abView->setFocus(); | 471 | // m_abView->setFocus(); |
509 | 472 | ||
510 | } | 473 | } |
511 | 474 | ||
@@ -513,24 +476,8 @@ void AddressbookWindow::slotViewBack() | |||
513 | { | 476 | { |
514 | // :SX showList(); | 477 | // :SX showList(); |
515 | } | 478 | } |
516 | 479 | ||
517 | void AddressbookWindow::slotViewEdit() | ||
518 | { | ||
519 | if(!syncing) { | ||
520 | if (actionPersonal->isOn()) { | ||
521 | editPersonal(); | ||
522 | } else { | ||
523 | editEntry( EditEntry ); | ||
524 | } | ||
525 | } else { | ||
526 | QMessageBox::warning( this, tr("Contacts"), | ||
527 | tr("Can not edit data, currently syncing") ); | ||
528 | } | ||
529 | } | ||
530 | |||
531 | |||
532 | |||
533 | void AddressbookWindow::writeMail() | 480 | void AddressbookWindow::writeMail() |
534 | { | 481 | { |
535 | Opie::OPimContact c = m_abView -> currentEntry(); | 482 | Opie::OPimContact c = m_abView -> currentEntry(); |
536 | QString name = c.fileAs(); | 483 | QString name = c.fileAs(); |
@@ -566,48 +513,8 @@ void AddressbookWindow::writeMail() | |||
566 | } | 513 | } |
567 | 514 | ||
568 | } | 515 | } |
569 | 516 | ||
570 | static const char * beamfile = "/tmp/obex/contact.vcf"; | ||
571 | |||
572 | void AddressbookWindow::slotBeam() | ||
573 | { | ||
574 | QString beamFilename; | ||
575 | Opie::OPimContact c; | ||
576 | if ( actionPersonal->isOn() ) { | ||
577 | beamFilename = addressbookPersonalVCardName(); | ||
578 | if ( !QFile::exists( beamFilename ) ) | ||
579 | return; // can't beam a non-existent file | ||
580 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | ||
581 | beamFilename ); | ||
582 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | ||
583 | Opie::OPimContactAccess::List allList = access->allRecords(); | ||
584 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | ||
585 | c = *it; | ||
586 | |||
587 | delete access; | ||
588 | } else { | ||
589 | unlink( beamfile ); // delete if exists | ||
590 | mkdir("/tmp/obex/", 0755); | ||
591 | c = m_abView -> currentEntry(); | ||
592 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | ||
593 | beamfile ); | ||
594 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | ||
595 | access->add( c ); | ||
596 | access->save(); | ||
597 | delete access; | ||
598 | |||
599 | beamFilename = beamfile; | ||
600 | } | ||
601 | |||
602 | odebug << "Beaming: " << beamFilename << oendl; | ||
603 | |||
604 | Ir *ir = new Ir( this ); | ||
605 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | ||
606 | QString description = c.fullName(); | ||
607 | ir->send( beamFilename, description, "text/x-vCard" ); | ||
608 | } | ||
609 | |||
610 | void AddressbookWindow::beamDone( Ir *ir ) | 517 | void AddressbookWindow::beamDone( Ir *ir ) |
611 | { | 518 | { |
612 | 519 | ||
613 | delete ir; | 520 | delete ir; |
@@ -644,14 +551,17 @@ static void parseName( const QString& name, QString *first, QString *middle, | |||
644 | 551 | ||
645 | 552 | ||
646 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 553 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
647 | { | 554 | { |
648 | bool needShow = FALSE; | 555 | bool needShow = false; |
649 | odebug << "Receiving QCop-Call with message " << msg << oendl; | 556 | odebug << "Receiving QCop-Call with message " << msg << oendl; |
650 | 557 | ||
651 | 558 | ||
652 | if (msg == "editPersonal()") { | 559 | if (msg == "editPersonal()") { |
653 | editPersonal(); | 560 | editPersonal(); |
561 | |||
562 | // Categories might have changed, so reload | ||
563 | reloadCategories(); | ||
654 | } else if (msg == "editPersonalAndClose()") { | 564 | } else if (msg == "editPersonalAndClose()") { |
655 | editPersonal(); | 565 | editPersonal(); |
656 | close(); | 566 | close(); |
657 | } else if ( msg == "addContact(QString,QString)" ) { | 567 | } else if ( msg == "addContact(QString,QString)" ) { |
@@ -673,8 +583,11 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | |||
673 | m_abView -> addEntry( cnt ); | 583 | m_abView -> addEntry( cnt ); |
674 | 584 | ||
675 | // :SXm_abView()->init( cnt ); | 585 | // :SXm_abView()->init( cnt ); |
676 | editEntry( EditEntry ); | 586 | editEntry( EditEntry ); |
587 | |||
588 | // Categories might have changed, so reload | ||
589 | reloadCategories(); | ||
677 | } else if ( msg == "beamBusinessCard()" ) { | 590 | } else if ( msg == "beamBusinessCard()" ) { |
678 | QString beamFilename = addressbookPersonalVCardName(); | 591 | QString beamFilename = addressbookPersonalVCardName(); |
679 | if ( !QFile::exists( beamFilename ) ) | 592 | if ( !QFile::exists( beamFilename ) ) |
680 | return; // can't beam a non-existent file | 593 | return; // can't beam a non-existent file |
@@ -691,10 +604,10 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | |||
691 | 604 | ||
692 | odebug << "Showing uid: " << uid << oendl; | 605 | odebug << "Showing uid: " << uid << oendl; |
693 | 606 | ||
694 | // Deactivate Personal View.. | 607 | // Deactivate Personal View.. |
695 | if ( actionPersonal->isOn() ){ | 608 | if ( m_actionPersonal->isOn() ){ |
696 | actionPersonal->setOn( false ); | 609 | m_actionPersonal->setOn( false ); |
697 | slotPersonalView(); | 610 | slotPersonalView(); |
698 | } | 611 | } |
699 | 612 | ||
700 | // Reset category and show as card.. | 613 | // Reset category and show as card.. |
@@ -710,22 +623,24 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | |||
710 | int uid; | 623 | int uid; |
711 | stream >> uid; | 624 | stream >> uid; |
712 | 625 | ||
713 | // Deactivate Personal View.. | 626 | // Deactivate Personal View.. |
714 | if ( actionPersonal->isOn() ){ | 627 | if ( m_actionPersonal->isOn() ){ |
715 | actionPersonal->setOn( false ); | 628 | m_actionPersonal->setOn( false ); |
716 | slotPersonalView(); | 629 | slotPersonalView(); |
717 | } | 630 | } |
718 | 631 | ||
719 | // Reset category and edit.. | 632 | // Reset category and edit.. |
720 | m_abView -> setShowByCategory( QString::null ); | 633 | m_abView -> setShowByCategory( QString::null ); |
721 | m_abView -> setCurrentUid( uid ); | 634 | m_abView -> setCurrentUid( uid ); |
722 | slotViewEdit(); | 635 | slotItemEdit(); |
723 | } | 636 | |
637 | // Categories might have changed, so reload | ||
638 | reloadCategories(); | ||
639 | } | ||
724 | 640 | ||
725 | if (needShow) | 641 | if (needShow) |
726 | QPEApplication::setKeepRunning(); | 642 | QPEApplication::setKeepRunning(); |
727 | |||
728 | } | 643 | } |
729 | 644 | ||
730 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 645 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
731 | { | 646 | { |
@@ -739,11 +654,11 @@ void AddressbookWindow::editEntry( EntryMode entryMode ) | |||
739 | abEditor->setEntry( entry ); | 654 | abEditor->setEntry( entry ); |
740 | // other things may change the caption. | 655 | // other things may change the caption. |
741 | abEditor->setCaption( tr("Edit Address") ); | 656 | abEditor->setCaption( tr("Edit Address") ); |
742 | 657 | ||
743 | // fix the foxus... | 658 | // fix the focus... |
744 | abEditor->setNameFocus(); | 659 | abEditor->setNameFocus(); |
745 | if ( QPEApplication::execDialog( abEditor ) ) { | 660 | if ( QPEApplication::execDialog( abEditor ) == QDialog::Accepted ) { |
746 | setFocus(); | 661 | setFocus(); |
747 | if ( entryMode == NewEntry ) { | 662 | if ( entryMode == NewEntry ) { |
748 | Opie::OPimContact insertEntry = abEditor->entry(); | 663 | Opie::OPimContact insertEntry = abEditor->entry(); |
749 | insertEntry.assignUid(); | 664 | insertEntry.assignUid(); |
@@ -756,22 +671,23 @@ void AddressbookWindow::editEntry( EntryMode entryMode ) | |||
756 | replEntry.assignUid(); | 671 | replEntry.assignUid(); |
757 | 672 | ||
758 | m_abView -> replaceEntry( replEntry ); | 673 | m_abView -> replaceEntry( replEntry ); |
759 | } | 674 | } |
760 | } | ||
761 | // populateCategories(); | ||
762 | 675 | ||
676 | // Categories might have changed, so reload | ||
677 | reloadCategories(); | ||
678 | } | ||
763 | } | 679 | } |
764 | 680 | ||
765 | void AddressbookWindow::editPersonal() | 681 | void AddressbookWindow::editPersonal() |
766 | { | 682 | { |
767 | Opie::OPimContact entry; | 683 | Opie::OPimContact entry; |
768 | 684 | ||
769 | // Switch to personal view if not selected | 685 | // Switch to personal view if not selected |
770 | // but take care of the menu, too | 686 | // but take care of the menu, too |
771 | if ( ! actionPersonal->isOn() ){ | 687 | if ( ! m_actionPersonal->isOn() ){ |
772 | odebug << "*** ++++" << oendl; | 688 | odebug << "*** ++++" << oendl; |
773 | actionPersonal->setOn( true ); | 689 | m_actionPersonal->setOn( true ); |
774 | slotPersonalView(); | 690 | slotPersonalView(); |
775 | } | 691 | } |
776 | 692 | ||
777 | if ( !abEditor ) { | 693 | if ( !abEditor ) { |
@@ -787,55 +703,36 @@ void AddressbookWindow::editPersonal() | |||
787 | 703 | ||
788 | 704 | ||
789 | void AddressbookWindow::slotPersonalView() | 705 | void AddressbookWindow::slotPersonalView() |
790 | { | 706 | { |
791 | odebug << "slotPersonalView()" << oendl; | 707 | odebug << "slotPersonalView()" << oendl; |
792 | if (!actionPersonal->isOn()) { | ||
793 | // we just turned it off | ||
794 | odebug << "slotPersonalView()-> OFF" << oendl; | ||
795 | setCaption( tr("Contacts") ); | ||
796 | actionNew->setEnabled(TRUE); | ||
797 | actionTrash->setEnabled(TRUE); | ||
798 | actionFind->setEnabled(TRUE); | ||
799 | actionMail->setEnabled(TRUE); | ||
800 | // slotUpdateToolbar(); | ||
801 | |||
802 | m_abView->showPersonal( false ); | ||
803 | 708 | ||
804 | return; | 709 | bool personal = m_actionPersonal->isOn(); |
805 | } | ||
806 | |||
807 | odebug << "slotPersonalView()-> ON" << oendl; | ||
808 | // XXX need to disable some QActions. | ||
809 | actionNew->setEnabled(FALSE); | ||
810 | actionTrash->setEnabled(FALSE); | ||
811 | actionFind->setEnabled(FALSE); | ||
812 | actionMail->setEnabled(FALSE); | ||
813 | 710 | ||
814 | setCaption( tr("Contacts - My Personal Details") ); | 711 | // Disable certain menu items when showing personal details |
712 | setItemNewEnabled( !personal ); | ||
713 | setItemDuplicateEnabled( !personal ); | ||
714 | setItemDeleteEnabled( !personal ); | ||
715 | m_actionMail->setEnabled( !personal ); | ||
815 | 716 | ||
816 | m_abView->showPersonal( true ); | 717 | // Display appropriate view |
718 | m_abView->showPersonal( personal ); | ||
817 | 719 | ||
818 | } | 720 | // Set application caption |
819 | 721 | personal ? setCaption( tr( "Contacts - My Personal Details") ) | |
820 | 722 | : setCaption( tr( "Contacts") ); | |
821 | void AddressbookWindow::listIsEmpty( bool empty ) | ||
822 | { | ||
823 | if ( !empty ) { | ||
824 | deleteButton->setEnabled( TRUE ); | ||
825 | } | ||
826 | } | 723 | } |
827 | 724 | ||
828 | void AddressbookWindow::reload() | 725 | void AddressbookWindow::reload() |
829 | { | 726 | { |
830 | syncing = FALSE; | 727 | syncing = false; |
831 | m_abView->clear(); | 728 | m_abView->clear(); |
832 | m_abView->reload(); | 729 | m_abView->reload(); |
833 | } | 730 | } |
834 | 731 | ||
835 | void AddressbookWindow::flush() | 732 | void AddressbookWindow::flush() |
836 | { | 733 | { |
837 | syncing = TRUE; | 734 | syncing = true; |
838 | m_abView->save(); | 735 | m_abView->save(); |
839 | } | 736 | } |
840 | 737 | ||
841 | 738 | ||
@@ -862,9 +759,9 @@ void AddressbookWindow::closeEvent( QCloseEvent *e ) | |||
862 | e->ignore(); | 759 | e->ignore(); |
863 | } | 760 | } |
864 | 761 | ||
865 | /* | 762 | /* |
866 | Returns TRUE if it is OK to exit | 763 | Returns true if it is OK to exit |
867 | */ | 764 | */ |
868 | 765 | ||
869 | bool AddressbookWindow::save() | 766 | bool AddressbookWindow::save() |
870 | { | 767 | { |
@@ -876,13 +773,13 @@ bool AddressbookWindow::save() | |||
876 | "\nQuit anyway?"), | 773 | "\nQuit anyway?"), |
877 | QMessageBox::Yes|QMessageBox::Escape, | 774 | QMessageBox::Yes|QMessageBox::Escape, |
878 | QMessageBox::No|QMessageBox::Default ) | 775 | QMessageBox::No|QMessageBox::Default ) |
879 | != QMessageBox::No ) | 776 | != QMessageBox::No ) |
880 | return TRUE; | 777 | return true; |
881 | else | 778 | else |
882 | return FALSE; | 779 | return false; |
883 | } | 780 | } |
884 | return TRUE; | 781 | return true; |
885 | } | 782 | } |
886 | 783 | ||
887 | #ifdef __DEBUG_RELEASE | 784 | #ifdef __DEBUG_RELEASE |
888 | void AddressbookWindow::slotSave() | 785 | void AddressbookWindow::slotSave() |
@@ -908,89 +805,20 @@ void AddressbookWindow::slotWrapAround() | |||
908 | // tr( "End of list. Wrap around now...!" ) + "\n" ); | 805 | // tr( "End of list. Wrap around now...!" ) + "\n" ); |
909 | 806 | ||
910 | } | 807 | } |
911 | 808 | ||
912 | void AddressbookWindow::slotSetCategory( int c ) | 809 | void AddressbookWindow::slotSetCategory( const QString &category ) |
913 | { | 810 | { |
914 | odebug << "void AddressbookWindow::slotSetCategory( " << c << " ) from " | 811 | odebug << "void AddressbookWindow::slotSetCategory( " << category << " )" << oendl; |
915 | << catMenu->count() << oendl; | ||
916 | |||
917 | QString cat, book; | ||
918 | AbView::Views view = AbView::TableView; | ||
919 | |||
920 | if ( c <= 0 ) | ||
921 | return; | ||
922 | |||
923 | // Switch view | ||
924 | if ( c < 3 ) | ||
925 | for ( unsigned int i = 1; i < 3; i++ ){ | ||
926 | if ( catMenu ) | ||
927 | catMenu->setItemChecked( i, c == (int)i ); | ||
928 | } | ||
929 | else | ||
930 | // Checkmark Category Menu Item Selected | ||
931 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) | ||
932 | catMenu->setItemChecked( i, c == (int)i ); | ||
933 | |||
934 | // Now switch to the selected category | ||
935 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { | ||
936 | if (catMenu->isItemChecked( i )) { | ||
937 | if ( i == 1 ){ // default List view | ||
938 | book = QString::null; | ||
939 | view = AbView::TableView; | ||
940 | }else if ( i == 2 ){ | ||
941 | book = tr( "Cards" ); | ||
942 | view = AbView::CardView; | ||
943 | // }else if ( i == 3 ){ | ||
944 | // book = tr( "Personal" ); | ||
945 | // view = AbView:: PersonalView; | ||
946 | }else if ( i == 3 ){ // default All Categories | ||
947 | cat = QString::null; | ||
948 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled | ||
949 | cat = "Unfiled"; | ||
950 | odebug << "Unfiled selected!" << oendl; | ||
951 | }else{ | ||
952 | cat = m_abView->categories()[i - 4]; | ||
953 | } | ||
954 | } | ||
955 | } | ||
956 | |||
957 | // Switch to the selected View | ||
958 | slotViewSwitched( view ); | ||
959 | 812 | ||
960 | // Tell the view about the selected category | 813 | // Tell the view about the selected category |
961 | m_abView -> setShowByCategory( cat ); | 814 | m_config.setCategory( category ); |
962 | 815 | m_abView -> setShowByCategory( category ); | |
963 | if ( book.isEmpty() ) | ||
964 | book = "List"; | ||
965 | if ( cat.isEmpty() ) | ||
966 | cat = "All"; | ||
967 | |||
968 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); | ||
969 | } | 816 | } |
970 | 817 | ||
971 | void AddressbookWindow::slotViewSwitched( int view ) | 818 | void AddressbookWindow::slotViewSwitched( int view ) |
972 | { | 819 | { |
973 | odebug << "void AddressbookWindow::slotViewSwitched( " << view << " )" << oendl; | 820 | odebug << "void AddressbookWindow::slotViewSwitched( " << view << " )" << oendl; |
974 | int menu = 0; | ||
975 | |||
976 | // Switch to selected view | ||
977 | switch ( view ){ | ||
978 | case AbView::TableView: | ||
979 | menu = 1; | ||
980 | m_tableViewButton->setOn(true); | ||
981 | m_cardViewButton->setOn(false); | ||
982 | break; | ||
983 | case AbView::CardView: | ||
984 | menu = 2; | ||
985 | m_tableViewButton->setOn(false); | ||
986 | m_cardViewButton->setOn(true); | ||
987 | break; | ||
988 | } | ||
989 | for ( unsigned int i = 1; i < 3; i++ ){ | ||
990 | if ( catMenu ) | ||
991 | catMenu->setItemChecked( i, menu == (int)i ); | ||
992 | } | ||
993 | 821 | ||
994 | // Tell the view about the selected view | 822 | // Tell the view about the selected view |
995 | m_abView -> setShowToView ( (AbView::Views) view ); | 823 | m_abView -> setShowToView ( (AbView::Views) view ); |
996 | active_view = view; | 824 | active_view = view; |
@@ -1012,38 +840,4 @@ void AddressbookWindow::slotSetLetter( char c ) { | |||
1012 | m_abView->setShowByLetter( c, m_config.letterPickerSearch() ); | 840 | m_abView->setShowByLetter( c, m_config.letterPickerSearch() ); |
1013 | 841 | ||
1014 | } | 842 | } |
1015 | 843 | ||
1016 | |||
1017 | void AddressbookWindow::populateCategories() | ||
1018 | { | ||
1019 | catMenu->clear(); | ||
1020 | |||
1021 | int id, rememberId; | ||
1022 | id = 1; | ||
1023 | rememberId = 0; | ||
1024 | |||
1025 | catMenu->insertItem( Resource::loadPixmap( "addressbook/listview" ), tr( "List" ), id++ ); | ||
1026 | catMenu->insertItem( Resource::loadPixmap( "addressbook/cardview" ), tr( "Cards" ), id++ ); | ||
1027 | // catMenu->insertItem( tr( "Personal" ), id++ ); | ||
1028 | catMenu->insertSeparator(); | ||
1029 | |||
1030 | catMenu->insertItem( tr( "All" ), id++ ); | ||
1031 | QStringList categories = m_abView->categories(); | ||
1032 | categories.append( tr( "Unfiled" ) ); | ||
1033 | for ( QStringList::Iterator it = categories.begin(); | ||
1034 | it != categories.end(); ++it ) { | ||
1035 | catMenu->insertItem( *it, id ); | ||
1036 | if ( *it == m_abView -> showCategory() ) | ||
1037 | rememberId = id; | ||
1038 | ++id; | ||
1039 | } | ||
1040 | |||
1041 | |||
1042 | if ( m_abView -> showCategory().isEmpty() ) { | ||
1043 | slotSetCategory( 3 ); | ||
1044 | } | ||
1045 | else { | ||
1046 | slotSetCategory( rememberId ); | ||
1047 | } | ||
1048 | } | ||
1049 | |||
diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h index 7cc61bf..b04e2cc 100644 --- a/core/pim/addressbook/addressbook.h +++ b/core/pim/addressbook/addressbook.h | |||
@@ -22,9 +22,10 @@ | |||
22 | 22 | ||
23 | // Remove this for OPIE releae 1.0 ! | 23 | // Remove this for OPIE releae 1.0 ! |
24 | // #define __DEBUG_RELEASE | 24 | // #define __DEBUG_RELEASE |
25 | 25 | ||
26 | #include <qmainwindow.h> | 26 | #include <opie2/opimmainwindow.h> |
27 | |||
27 | #include <qvaluelist.h> | 28 | #include <qvaluelist.h> |
28 | #include <qstringlist.h> | 29 | #include <qstringlist.h> |
29 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
30 | #include "ofloatbar.h" | 31 | #include "ofloatbar.h" |
@@ -40,10 +41,11 @@ class QToolButton; | |||
40 | class QDialog; | 41 | class QDialog; |
41 | class Ir; | 42 | class Ir; |
42 | class QAction; | 43 | class QAction; |
43 | class LetterPicker; | 44 | class LetterPicker; |
45 | class Opie::OPimRecord; | ||
44 | 46 | ||
45 | class AddressbookWindow: public QMainWindow | 47 | class AddressbookWindow: public Opie::OPimMainWindow |
46 | { | 48 | { |
47 | Q_OBJECT | 49 | Q_OBJECT |
48 | public: | 50 | public: |
49 | enum EntryMode { NewEntry=0, EditEntry }; | 51 | enum EntryMode { NewEntry=0, EditEntry }; |
@@ -68,56 +70,57 @@ public slots: | |||
68 | #ifdef __DEBUG_RELEASE | 70 | #ifdef __DEBUG_RELEASE |
69 | // void slotSave(); | 71 | // void slotSave(); |
70 | #endif | 72 | #endif |
71 | 73 | ||
74 | protected slots: | ||
75 | int create(); | ||
76 | bool remove( int uid ); | ||
77 | void beam( int uid ); | ||
78 | void show( int uid ); | ||
79 | void edit( int uid ); | ||
80 | void add( const Opie::OPimRecord& ); | ||
81 | |||
72 | private slots: | 82 | private slots: |
83 | void slotItemNew(); | ||
84 | void slotItemEdit(); | ||
85 | void slotItemDuplicate(); | ||
86 | void slotItemDelete(); | ||
87 | void slotItemBeam(); | ||
88 | void slotItemFind(); | ||
89 | void slotConfigure(); | ||
90 | |||
73 | void importvCard(); | 91 | void importvCard(); |
74 | void exportvCard(); | 92 | void exportvCard(); |
75 | void slotListNew(); | ||
76 | /* void slotListView(); */ | ||
77 | void slotListDelete(); | ||
78 | void slotViewBack(); | 93 | void slotViewBack(); |
79 | void slotViewEdit(); | ||
80 | void slotPersonalView(); | 94 | void slotPersonalView(); |
81 | void listIsEmpty( bool ); | ||
82 | /* void slotSettings(); */ | ||
83 | void writeMail(); | 95 | void writeMail(); |
84 | void slotBeam(); | ||
85 | void beamDone( Ir * ); | 96 | void beamDone( Ir * ); |
86 | void slotSetCategory( int ); | 97 | void slotSetCategory( const QString &category ); |
87 | void slotSetLetter( char ); | 98 | void slotSetLetter( char ); |
88 | void slotUpdateToolbar(); | ||
89 | void slotSetFont(int); | 99 | void slotSetFont(int); |
90 | 100 | ||
91 | void slotFindOpen(); | 101 | void slotShowFind( bool show ); |
92 | void slotFindClose(); | ||
93 | void slotFind(); | 102 | void slotFind(); |
94 | void slotNotFound(); | 103 | void slotNotFound(); |
95 | void slotWrapAround(); | 104 | void slotWrapAround(); |
96 | 105 | ||
97 | void slotViewSwitched( int ); | 106 | void slotViewSwitched( int ); |
98 | void slotListView(); | 107 | void slotListView(); |
99 | void slotCardView(); | 108 | void slotCardView(); |
100 | 109 | ||
101 | void slotConfig(); | ||
102 | |||
103 | private: | 110 | private: |
104 | void populateCategories(); | ||
105 | |||
106 | QPopupMenu *catMenu; | ||
107 | QToolBar *listTools; | 111 | QToolBar *listTools; |
108 | QToolButton *deleteButton; | ||
109 | enum Panes { paneList=0, paneView, paneEdit }; | 112 | enum Panes { paneList=0, paneView, paneEdit }; |
110 | ContactEditor *abEditor; | 113 | ContactEditor *abEditor; |
111 | LetterPicker *pLabel; | 114 | LetterPicker *pLabel; |
112 | AbView* m_abView; | 115 | AbView* m_abView; |
113 | QWidget *listContainer; | 116 | QWidget *m_listContainer; |
114 | 117 | ||
115 | // Searching stuff | 118 | // Searching stuff |
116 | OFloatBar* searchBar; | 119 | OFloatBar* m_searchBar; |
117 | QLineEdit* searchEdit; | 120 | QLineEdit* m_searchEdit; |
118 | 121 | ||
119 | QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, *actionPersonal, *actionMail; | 122 | QAction *m_actionPersonal, *m_actionMail; |
120 | 123 | ||
121 | int viewMargin; | 124 | int viewMargin; |
122 | 125 | ||
123 | bool syncing; | 126 | bool syncing; |
@@ -127,11 +130,8 @@ private: | |||
127 | bool isLoading; | 130 | bool isLoading; |
128 | 131 | ||
129 | AbConfig m_config; | 132 | AbConfig m_config; |
130 | 133 | ||
131 | QAction* m_tableViewButton; | ||
132 | QAction* m_cardViewButton; | ||
133 | |||
134 | int active_view; | 134 | int active_view; |
135 | }; | 135 | }; |
136 | 136 | ||
137 | #endif | 137 | #endif |
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index b078968..dec4c7c 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -30,9 +30,8 @@ | |||
30 | #include <qpe/qpedialog.h> | 30 | #include <qpe/qpedialog.h> |
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | 32 | ||
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qtabwidget.h> | ||
35 | #include <qlayout.h> | 34 | #include <qlayout.h> |
36 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
37 | #include <qmultilineedit.h> | 36 | #include <qmultilineedit.h> |
38 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
@@ -57,9 +56,9 @@ void parseEmailTo( const QString &strDefaultEmail, | |||
57 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, | 56 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, |
58 | QWidget *parent, | 57 | QWidget *parent, |
59 | const char *name, | 58 | const char *name, |
60 | WFlags ) | 59 | WFlags ) |
61 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), | 60 | : QDialog( parent, name, true, WStyle_ContextHelp ), |
62 | defaultEmailChooserPosition( -1 ), | 61 | defaultEmailChooserPosition( -1 ), |
63 | m_personalView ( false ), | 62 | m_personalView ( false ), |
64 | cmbDefaultEmail( 0 ), | 63 | cmbDefaultEmail( 0 ), |
65 | initializing ( false ) | 64 | initializing ( false ) |
@@ -118,16 +117,16 @@ void ContactEditor::init() { | |||
118 | 117 | ||
119 | 118 | ||
120 | QVBoxLayout *vb = new QVBoxLayout( this ); | 119 | QVBoxLayout *vb = new QVBoxLayout( this ); |
121 | 120 | ||
122 | tabMain = new QTabWidget( this ); | 121 | tabMain = new Opie::Ui::OTabWidget( this ); |
123 | vb->addWidget( tabMain ); | 122 | vb->addWidget( tabMain ); |
124 | 123 | ||
125 | QWidget *tabViewport = new QWidget ( tabMain ); | 124 | m_generalWidget = new QWidget ( tabMain ); |
126 | 125 | ||
127 | vb = new QVBoxLayout( tabViewport ); | 126 | vb = new QVBoxLayout( m_generalWidget ); |
128 | 127 | ||
129 | svGeneral = new QScrollView( tabViewport ); | 128 | svGeneral = new QScrollView( m_generalWidget ); |
130 | vb->addWidget( svGeneral, 0, 0 ); | 129 | vb->addWidget( svGeneral, 0, 0 ); |
131 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 130 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
132 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); | 131 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); |
133 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); | 132 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); |
@@ -135,10 +134,9 @@ void ContactEditor::init() { | |||
135 | 134 | ||
136 | QWidget *container = new QWidget( svGeneral->viewport() ); | 135 | QWidget *container = new QWidget( svGeneral->viewport() ); |
137 | svGeneral->addChild( container ); | 136 | svGeneral->addChild( container ); |
138 | 137 | ||
139 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 138 | QGridLayout *gl = new QGridLayout( container, 10, 2, 2, 4 ); |
140 | gl->setResizeMode( QLayout::FreeResize ); | ||
141 | 139 | ||
142 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 140 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
143 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); | 141 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); |
144 | gl->addWidget( btnFullName, 0, 0 ); | 142 | gl->addWidget( btnFullName, 0, 0 ); |
@@ -167,9 +165,9 @@ void ContactEditor::init() { | |||
167 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); | 165 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); |
168 | gl->addWidget( txtOrganization, 3, 1 ); | 166 | gl->addWidget( txtOrganization, 3, 1 ); |
169 | 167 | ||
170 | // Chooser 1 | 168 | // Chooser 1 |
171 | cmbChooserField1 = new QComboBox( FALSE, container ); | 169 | cmbChooserField1 = new QComboBox( false, container ); |
172 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); | 170 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); |
173 | cmbChooserField1->setMaximumWidth( 90 ); | 171 | cmbChooserField1->setMaximumWidth( 90 ); |
174 | gl->addWidget( cmbChooserField1, 4, 0 ); | 172 | gl->addWidget( cmbChooserField1, 4, 0 ); |
175 | // Textfield for chooser 1. | 173 | // Textfield for chooser 1. |
@@ -180,9 +178,9 @@ void ContactEditor::init() { | |||
180 | gl->addWidget( m_widgetStack1, 4, 1 ); | 178 | gl->addWidget( m_widgetStack1, 4, 1 ); |
181 | m_widgetStack1 -> raiseWidget( TextField ); | 179 | m_widgetStack1 -> raiseWidget( TextField ); |
182 | 180 | ||
183 | // Chooser 2 | 181 | // Chooser 2 |
184 | cmbChooserField2 = new QComboBox( FALSE, container ); | 182 | cmbChooserField2 = new QComboBox( false, container ); |
185 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); | 183 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); |
186 | cmbChooserField2->setMaximumWidth( 90 ); | 184 | cmbChooserField2->setMaximumWidth( 90 ); |
187 | gl->addWidget( cmbChooserField2, 5, 0 ); | 185 | gl->addWidget( cmbChooserField2, 5, 0 ); |
188 | // Textfield for chooser 2 | 186 | // Textfield for chooser 2 |
@@ -193,9 +191,9 @@ void ContactEditor::init() { | |||
193 | gl->addWidget( m_widgetStack2, 5, 1 ); | 191 | gl->addWidget( m_widgetStack2, 5, 1 ); |
194 | m_widgetStack2 -> raiseWidget( TextField ); | 192 | m_widgetStack2 -> raiseWidget( TextField ); |
195 | 193 | ||
196 | // Chooser 3 | 194 | // Chooser 3 |
197 | cmbChooserField3 = new QComboBox( FALSE, container ); | 195 | cmbChooserField3 = new QComboBox( false, container ); |
198 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); | 196 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); |
199 | cmbChooserField3->setMaximumWidth( 90 ); | 197 | cmbChooserField3->setMaximumWidth( 90 ); |
200 | gl->addWidget( cmbChooserField3, 6, 0 ); | 198 | gl->addWidget( cmbChooserField3, 6, 0 ); |
201 | // Textfield for chooser 2 | 199 | // Textfield for chooser 2 |
@@ -208,9 +206,9 @@ void ContactEditor::init() { | |||
208 | 206 | ||
209 | l = new QLabel( tr( "File As" ), container ); | 207 | l = new QLabel( tr( "File As" ), container ); |
210 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); | 208 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); |
211 | gl->addWidget( l, 7, 0 ); | 209 | gl->addWidget( l, 7, 0 ); |
212 | cmbFileAs = new QComboBox( TRUE, container ); | 210 | cmbFileAs = new QComboBox( true, container ); |
213 | gl->addWidget( cmbFileAs, 7, 1 ); | 211 | gl->addWidget( cmbFileAs, 7, 1 ); |
214 | 212 | ||
215 | labCat = new QLabel( tr( "Category" ), container ); | 213 | labCat = new QLabel( tr( "Category" ), container ); |
216 | gl->addWidget( labCat, 8, 0 ); | 214 | gl->addWidget( labCat, 8, 0 ); |
@@ -218,14 +216,14 @@ void ContactEditor::init() { | |||
218 | gl->addWidget( cmbCat, 8, 1 ); | 216 | gl->addWidget( cmbCat, 8, 1 ); |
219 | labCat->show(); | 217 | labCat->show(); |
220 | cmbCat->show(); | 218 | cmbCat->show(); |
221 | 219 | ||
222 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 220 | btnNote = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Notes..." ), container ); |
223 | gl->addWidget( btnNote, 9, 1 ); | 221 | gl->addWidget( btnNote, 9, 1 ); |
224 | 222 | ||
225 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 223 | tabMain->addTab( m_generalWidget, "addressbook/AddressBookSmall", tr( "General" ) ); |
226 | 224 | ||
227 | tabViewport = new QWidget ( tabMain ); | 225 | QWidget *tabViewport = new QWidget ( tabMain ); |
228 | 226 | ||
229 | vb = new QVBoxLayout( tabViewport ); | 227 | vb = new QVBoxLayout( tabViewport ); |
230 | 228 | ||
231 | svAddress = new QScrollView( tabViewport ); | 229 | svAddress = new QScrollView( tabViewport ); |
@@ -237,9 +235,9 @@ void ContactEditor::init() { | |||
237 | svAddress->addChild( container ); | 235 | svAddress->addChild( container ); |
238 | 236 | ||
239 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 237 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
240 | 238 | ||
241 | cmbAddress = new QComboBox( FALSE, container ); | 239 | cmbAddress = new QComboBox( false, container ); |
242 | cmbAddress->insertItem( tr( "Business" ) ); | 240 | cmbAddress->insertItem( tr( "Business" ) ); |
243 | cmbAddress->insertItem( tr( "Home" ) ); | 241 | cmbAddress->insertItem( tr( "Home" ) ); |
244 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 242 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
245 | 243 | ||
@@ -264,9 +262,9 @@ void ContactEditor::init() { | |||
264 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 262 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
265 | 263 | ||
266 | l = new QLabel( tr( "Country" ), container ); | 264 | l = new QLabel( tr( "Country" ), container ); |
267 | gl->addWidget( l, 5, 0 ); | 265 | gl->addWidget( l, 5, 0 ); |
268 | cmbCountry = new QComboBox( TRUE, container ); | 266 | cmbCountry = new QComboBox( true, container ); |
269 | cmbCountry->insertItem( "" ); | 267 | cmbCountry->insertItem( "" ); |
270 | cmbCountry->insertItem( tr ( "United States" ) ); | 268 | cmbCountry->insertItem( tr ( "United States" ) ); |
271 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 269 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
272 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); | 270 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); |
@@ -484,9 +482,9 @@ void ContactEditor::init() { | |||
484 | 482 | ||
485 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 483 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
486 | 484 | ||
487 | // Chooser 4 | 485 | // Chooser 4 |
488 | cmbChooserField4 = new QComboBox( FALSE, container ); | 486 | cmbChooserField4 = new QComboBox( false, container ); |
489 | cmbChooserField4->setMaximumWidth( 90 ); | 487 | cmbChooserField4->setMaximumWidth( 90 ); |
490 | gl->addWidget( cmbChooserField4, 6, 0 ); | 488 | gl->addWidget( cmbChooserField4, 6, 0 ); |
491 | // Textfield for chooser 2 | 489 | // Textfield for chooser 2 |
492 | // Now use WidgetStack to contain the textfield and the default-email combo! | 490 | // Now use WidgetStack to contain the textfield and the default-email combo! |
@@ -500,9 +498,9 @@ void ContactEditor::init() { | |||
500 | QSizePolicy::Maximum, | 498 | QSizePolicy::Maximum, |
501 | QSizePolicy::MinimumExpanding ); | 499 | QSizePolicy::MinimumExpanding ); |
502 | gl->addItem( space, 7, 0 ); | 500 | gl->addItem( space, 7, 0 ); |
503 | 501 | ||
504 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 502 | tabMain->addTab( tabViewport, "home", tr( "Address" ) ); |
505 | 503 | ||
506 | tabViewport = new QWidget ( tabMain ); | 504 | tabViewport = new QWidget ( tabMain ); |
507 | 505 | ||
508 | vb = new QVBoxLayout( tabViewport ); | 506 | vb = new QVBoxLayout( tabViewport ); |
@@ -524,9 +522,9 @@ void ContactEditor::init() { | |||
524 | l = new QLabel( tr("Birthday"), container ); | 522 | l = new QLabel( tr("Birthday"), container ); |
525 | gl->addWidget( l, counter, 0 ); | 523 | gl->addWidget( l, counter, 0 ); |
526 | 524 | ||
527 | QPopupMenu* m1 = new QPopupMenu( container ); | 525 | QPopupMenu* m1 = new QPopupMenu( container ); |
528 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | 526 | birthdayPicker = new DateBookMonth( m1, 0, true ); |
529 | m1->insertItem( birthdayPicker ); | 527 | m1->insertItem( birthdayPicker ); |
530 | 528 | ||
531 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 529 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
532 | birthdayButton->setPopup( m1 ); | 530 | birthdayButton->setPopup( m1 ); |
@@ -549,9 +547,9 @@ void ContactEditor::init() { | |||
549 | l = new QLabel( tr("Anniversary"), container ); | 547 | l = new QLabel( tr("Anniversary"), container ); |
550 | gl->addWidget( l, counter, 0 ); | 548 | gl->addWidget( l, counter, 0 ); |
551 | 549 | ||
552 | m1 = new QPopupMenu( container ); | 550 | m1 = new QPopupMenu( container ); |
553 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 551 | anniversaryPicker = new DateBookMonth( m1, 0, true ); |
554 | m1->insertItem( anniversaryPicker ); | 552 | m1->insertItem( anniversaryPicker ); |
555 | 553 | ||
556 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 554 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
557 | anniversaryButton->setPopup( m1 ); | 555 | anniversaryButton->setPopup( m1 ); |
@@ -598,18 +596,18 @@ void ContactEditor::init() { | |||
598 | // Fill labels with names.. | 596 | // Fill labels with names.. |
599 | //loadFields(); | 597 | //loadFields(); |
600 | 598 | ||
601 | 599 | ||
602 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 600 | tabMain->addTab( tabViewport, "UtilsIcon", tr( "Details" ) ); |
603 | 601 | ||
604 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 602 | dlgNote = new QDialog( this, "Note Dialog", true ); |
605 | dlgNote->setCaption( tr("Enter Note") ); | 603 | dlgNote->setCaption( tr("Enter Note") ); |
606 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 604 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
607 | txtNote = new QMultiLineEdit( dlgNote ); | 605 | txtNote = new QMultiLineEdit( dlgNote ); |
608 | vbNote->addWidget( txtNote ); | 606 | vbNote->addWidget( txtNote ); |
609 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 607 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
610 | 608 | ||
611 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 609 | dlgName = new QDialog( this, "Name Dialog", true ); |
612 | dlgName->setCaption( tr("Edit Name") ); | 610 | dlgName->setCaption( tr("Edit Name") ); |
613 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 611 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
614 | 612 | ||
615 | l = new QLabel( tr("First Name"), dlgName ); | 613 | l = new QLabel( tr("First Name"), dlgName ); |
@@ -1092,9 +1090,9 @@ void ContactEditor::slotName() { | |||
1092 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1090 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1093 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1091 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1094 | 1092 | ||
1095 | if ( QPEApplication::execDialog( dlgName ) ) { | 1093 | if ( QPEApplication::execDialog( dlgName ) ) { |
1096 | if ( txtLastName->text().contains( ' ', TRUE ) ) | 1094 | if ( txtLastName->text().contains( ' ', true ) ) |
1097 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); | 1095 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); |
1098 | else | 1096 | else |
1099 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); | 1097 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); |
1100 | 1098 | ||
@@ -1137,9 +1135,9 @@ QString ContactEditor::parseName( const QString fullName, int type ) { | |||
1137 | bool haveLastName = false; | 1135 | bool haveLastName = false; |
1138 | 1136 | ||
1139 | odebug << "Fullname: " << simplifiedName << oendl; | 1137 | odebug << "Fullname: " << simplifiedName << oendl; |
1140 | 1138 | ||
1141 | commapos = simplifiedName.find( ',', 0, TRUE); | 1139 | commapos = simplifiedName.find( ',', 0, true); |
1142 | if ( commapos >= 0 ) { | 1140 | if ( commapos >= 0 ) { |
1143 | odebug << " Commapos: " << commapos << oendl; | 1141 | odebug << " Commapos: " << commapos << oendl; |
1144 | 1142 | ||
1145 | // A comma (",") separates the lastname from one or | 1143 | // A comma (",") separates the lastname from one or |
@@ -1261,9 +1259,9 @@ void ContactEditor::setEntry( const Opie::OPimContact &entry ) { | |||
1261 | initializing = true; | 1259 | initializing = true; |
1262 | 1260 | ||
1263 | // Cleanup and activate the general Page .. | 1261 | // Cleanup and activate the general Page .. |
1264 | cleanupFields(); | 1262 | cleanupFields(); |
1265 | tabMain->setCurrentPage( 0 ); | 1263 | tabMain->setCurrentTab( m_generalWidget ); |
1266 | 1264 | ||
1267 | ent = entry; | 1265 | ent = entry; |
1268 | 1266 | ||
1269 | emails = QStringList(ent.emailList()); | 1267 | emails = QStringList(ent.emailList()); |
@@ -1282,9 +1280,9 @@ void ContactEditor::setEntry( const Opie::OPimContact &entry ) { | |||
1282 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1280 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1283 | 1281 | ||
1284 | if ( !ent.isEmpty() ){ | 1282 | if ( !ent.isEmpty() ){ |
1285 | // Lastnames with multiple words need to be protected by a comma ! | 1283 | // Lastnames with multiple words need to be protected by a comma ! |
1286 | if ( ent.lastName().contains( ' ', TRUE ) ) | 1284 | if ( ent.lastName().contains( ' ', true ) ) |
1287 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); | 1285 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); |
1288 | else | 1286 | else |
1289 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | 1287 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); |
1290 | } | 1288 | } |
@@ -1686,20 +1684,20 @@ static inline bool containsAlphaNum( const QString &str ) | |||
1686 | int i, | 1684 | int i, |
1687 | count = str.length(); | 1685 | count = str.length(); |
1688 | for ( i = 0; i < count; i++ ) | 1686 | for ( i = 0; i < count; i++ ) |
1689 | if ( !str[i].isSpace() ) | 1687 | if ( !str[i].isSpace() ) |
1690 | return TRUE; | 1688 | return true; |
1691 | return FALSE; | 1689 | return false; |
1692 | } | 1690 | } |
1693 | 1691 | ||
1694 | static inline bool constainsWhiteSpace( const QString &str ) | 1692 | static inline bool constainsWhiteSpace( const QString &str ) |
1695 | { | 1693 | { |
1696 | int i, | 1694 | int i, |
1697 | count = str.length(); | 1695 | count = str.length(); |
1698 | for (i = 0; i < count; i++ ) | 1696 | for (i = 0; i < count; i++ ) |
1699 | if ( str[i].isSpace() ) | 1697 | if ( str[i].isSpace() ) |
1700 | return TRUE; | 1698 | return true; |
1701 | return FALSE; | 1699 | return false; |
1702 | } | 1700 | } |
1703 | 1701 | ||
1704 | void ContactEditor::setPersonalView( bool personal ) | 1702 | void ContactEditor::setPersonalView( bool personal ) |
1705 | { | 1703 | { |
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index 1b86e6f..f3cbbd4 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h | |||
@@ -22,8 +22,9 @@ | |||
22 | #define CONTACTEDITOR_H | 22 | #define CONTACTEDITOR_H |
23 | 23 | ||
24 | #include <opie2/opimcontact.h> | 24 | #include <opie2/opimcontact.h> |
25 | #include <opie2/opimcontactfields.h> | 25 | #include <opie2/opimcontactfields.h> |
26 | #include <opie2/otabwidget.h> | ||
26 | 27 | ||
27 | #include <qpe/datebookmonth.h> | 28 | #include <qpe/datebookmonth.h> |
28 | 29 | ||
29 | #include <qdialog.h> | 30 | #include <qdialog.h> |
@@ -41,11 +42,9 @@ const int NAME_F = 4; | |||
41 | const int NAME_M = 5; | 42 | const int NAME_M = 5; |
42 | const int NAME_L = 6; | 43 | const int NAME_L = 6; |
43 | const int NAME_S = 7; | 44 | const int NAME_S = 7; |
44 | 45 | ||
45 | |||
46 | class QScrollView; | 46 | class QScrollView; |
47 | class QTabWidget; | ||
48 | class QMultiLineEdit; | 47 | class QMultiLineEdit; |
49 | class QLineEdit; | 48 | class QLineEdit; |
50 | class QComboBox; | 49 | class QComboBox; |
51 | class QPushButton; | 50 | class QPushButton; |
@@ -143,9 +142,10 @@ class ContactEditor : public QDialog { | |||
143 | QLineEdit *txtMiddleName; | 142 | QLineEdit *txtMiddleName; |
144 | QLineEdit *txtLastName; | 143 | QLineEdit *txtLastName; |
145 | QLineEdit *txtSuffix; | 144 | QLineEdit *txtSuffix; |
146 | 145 | ||
147 | QTabWidget *tabMain; | 146 | Opie::Ui::OTabWidget *tabMain; |
147 | QWidget *m_generalWidget; | ||
148 | QScrollView *svGeneral; | 148 | QScrollView *svGeneral; |
149 | QPushButton *btnFullName; | 149 | QPushButton *btnFullName; |
150 | QPushButton *btnNote; | 150 | QPushButton *btnNote; |
151 | QLineEdit *txtFullName; | 151 | QLineEdit *txtFullName; |