-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index d4b9f43..0276231 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -101,193 +101,194 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
101 | 101 | ||
102 | QPopupMenu *edit = new QPopupMenu( mbList ); | 102 | QPopupMenu *edit = new QPopupMenu( mbList ); |
103 | mbList->insertItem( tr( "Contact" ), edit ); | 103 | mbList->insertItem( tr( "Contact" ), edit ); |
104 | 104 | ||
105 | 105 | ||
106 | // View Icons | 106 | // View Icons |
107 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/weeklst" ), | 107 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/weeklst" ), |
108 | QString::null, 0, this, 0 ); | 108 | QString::null, 0, this, 0 ); |
109 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); | 109 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); |
110 | m_tableViewButton->setToggleAction( true ); | 110 | m_tableViewButton->setToggleAction( true ); |
111 | m_tableViewButton->addTo( listTools ); | 111 | m_tableViewButton->addTo( listTools ); |
112 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 ); | 112 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 ); |
113 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); | 113 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); |
114 | m_cardViewButton->setToggleAction( true ); | 114 | m_cardViewButton->setToggleAction( true ); |
115 | m_cardViewButton->addTo( listTools ); | 115 | m_cardViewButton->addTo( listTools ); |
116 | 116 | ||
117 | listTools->addSeparator(); | 117 | listTools->addSeparator(); |
118 | 118 | ||
119 | // Other Buttons | 119 | // Other Buttons |
120 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, | 120 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, |
121 | 0, this, 0 ); | 121 | 0, this, 0 ); |
122 | actionNew = a; | 122 | actionNew = a; |
123 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); | 123 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); |
124 | a->addTo( edit ); | 124 | a->addTo( edit ); |
125 | a->addTo( listTools ); | 125 | a->addTo( listTools ); |
126 | 126 | ||
127 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | 127 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, |
128 | 0, this, 0 ); | 128 | 0, this, 0 ); |
129 | actionEdit = a; | 129 | actionEdit = a; |
130 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); | 130 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); |
131 | a->addTo( edit ); | 131 | a->addTo( edit ); |
132 | a->addTo( listTools ); | 132 | a->addTo( listTools ); |
133 | 133 | ||
134 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 134 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
135 | 0, this, 0 ); | 135 | 0, this, 0 ); |
136 | actionTrash = a; | 136 | actionTrash = a; |
137 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); | 137 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); |
138 | a->addTo( edit ); | 138 | a->addTo( edit ); |
139 | a->addTo( listTools ); | 139 | a->addTo( listTools ); |
140 | 140 | ||
141 | 141 | ||
142 | // make it possible to go directly to businesscard via qcop call | 142 | // make it possible to go directly to businesscard via qcop call |
143 | //#if defined(Q_WS_QWS) // Why this ? (se) | 143 | //#if defined(Q_WS_QWS) // Why this ? (se) |
144 | #if !defined(QT_NO_COP) | 144 | #if !defined(QT_NO_COP) |
145 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); | 145 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); |
146 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), | 146 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), |
147 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); | 147 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); |
148 | #endif | 148 | #endif |
149 | // #endif | 149 | // #endif |
150 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), | 150 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), |
151 | QString::null, 0, this, 0 ); | 151 | QString::null, 0, this, 0 ); |
152 | actionFind = a; | 152 | actionFind = a; |
153 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); | 153 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); |
154 | a->addTo( edit ); | 154 | a->addTo( edit ); |
155 | a->addTo( listTools ); | 155 | a->addTo( listTools ); |
156 | 156 | ||
157 | // Much better search widget, taken from QTReader.. (se) | 157 | // Much better search widget, taken from QTReader.. (se) |
158 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); | 158 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); |
159 | searchBar->setHorizontalStretchable( TRUE ); | 159 | searchBar->setHorizontalStretchable( TRUE ); |
160 | searchBar->hide(); | 160 | searchBar->hide(); |
161 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 161 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
162 | 162 | ||
163 | // QFont f("unifont", 16 /*, QFont::Bold*/); | 163 | // QFont f("unifont", 16 /*, QFont::Bold*/); |
164 | // searchEdit->setFont( f ); | 164 | // searchEdit->setFont( f ); |
165 | 165 | ||
166 | searchBar->setStretchableWidget( searchEdit ); | 166 | searchBar->setStretchableWidget( searchEdit ); |
167 | connect( searchEdit, SIGNAL( returnPressed( ) ), | 167 | connect( searchEdit, SIGNAL( returnPressed( ) ), |
168 | this, SLOT( slotFind( ) ) ); | 168 | this, SLOT( slotFind( ) ) ); |
169 | 169 | ||
170 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | 170 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); |
171 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | 171 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); |
172 | a->addTo( searchBar ); | 172 | a->addTo( searchBar ); |
173 | 173 | ||
174 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 174 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
175 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); | 175 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); |
176 | a->addTo( searchBar ); | 176 | a->addTo( searchBar ); |
177 | 177 | ||
178 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), | 178 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), |
179 | QString::null, 0, this, 0 ); | 179 | QString::null, 0, this, 0 ); |
180 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 180 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
181 | actionMail = a; | 181 | actionMail = a; |
182 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 182 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
183 | a->addTo( edit ); | 183 | a->addTo( edit ); |
184 | a->addTo( listTools ); | 184 | a->addTo( listTools ); |
185 | 185 | ||
186 | if ( Ir::supported() ) { | 186 | if ( Ir::supported() ) { |
187 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | 187 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, |
188 | 0, this, 0 ); | 188 | 0, this, 0 ); |
189 | actionBeam = a; | 189 | actionBeam = a; |
190 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 190 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
191 | a->addTo( edit ); | 191 | a->addTo( edit ); |
192 | a->addTo( listTools ); | 192 | a->addTo( listTools ); |
193 | } | 193 | } |
194 | 194 | ||
195 | edit->insertSeparator(); | 195 | edit->insertSeparator(); |
196 | 196 | ||
197 | a = new QAction( tr("Import vCard"), QString::null, 0, 0); | 197 | a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null, |
198 | 0, this, 0); | ||
198 | actionPersonal = a; | 199 | actionPersonal = a; |
199 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); | 200 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); |
200 | a->addTo( edit ); | 201 | a->addTo( edit ); |
201 | 202 | ||
202 | edit->insertSeparator(); | 203 | edit->insertSeparator(); |
203 | 204 | ||
204 | a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), | 205 | a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), |
205 | QString::null, 0, this, 0 , TRUE ); | 206 | QString::null, 0, this, 0 , TRUE ); |
206 | actionPersonal = a; | 207 | actionPersonal = a; |
207 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); | 208 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); |
208 | a->addTo( edit ); | 209 | a->addTo( edit ); |
209 | 210 | ||
210 | 211 | ||
211 | #ifdef __DEBUG_RELEASE | 212 | #ifdef __DEBUG_RELEASE |
212 | // Remove this function for public Release ! This is only | 213 | // Remove this function for public Release ! This is only |
213 | // for debug purposes .. | 214 | // for debug purposes .. |
214 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); | 215 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); |
215 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); | 216 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); |
216 | a->addTo( edit ); | 217 | a->addTo( edit ); |
217 | #endif | 218 | #endif |
218 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "addressbook/configure" ), QString::null, | 219 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "addressbook/configure" ), QString::null, |
219 | 0, this, 0 ); | 220 | 0, this, 0 ); |
220 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); | 221 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); |
221 | a->addTo( edit ); | 222 | a->addTo( edit ); |
222 | 223 | ||
223 | // Create Views | 224 | // Create Views |
224 | listContainer = new QWidget( this ); | 225 | listContainer = new QWidget( this ); |
225 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | 226 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); |
226 | 227 | ||
227 | m_abView = new AbView( listContainer, m_config.orderList() ); | 228 | m_abView = new AbView( listContainer, m_config.orderList() ); |
228 | vb->addWidget( m_abView ); | 229 | vb->addWidget( m_abView ); |
229 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 230 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
230 | connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), | 231 | connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), |
231 | this, SLOT( slotViewSwitched( int ) ) ); | 232 | this, SLOT( slotViewSwitched( int ) ) ); |
232 | 233 | ||
233 | 234 | ||
234 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); | 235 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); |
235 | 236 | ||
236 | m_abView->load(); | 237 | m_abView->load(); |
237 | 238 | ||
238 | // Letter Picker | 239 | // Letter Picker |
239 | pLabel = new LetterPicker( listContainer ); | 240 | pLabel = new LetterPicker( listContainer ); |
240 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 241 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
241 | connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); | 242 | connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); |
242 | 243 | ||
243 | vb->addWidget( pLabel ); | 244 | vb->addWidget( pLabel ); |
244 | 245 | ||
245 | // Category Menu | 246 | // Category Menu |
246 | catMenu = new QPopupMenu( this ); | 247 | catMenu = new QPopupMenu( this ); |
247 | catMenu->setCheckable( TRUE ); | 248 | catMenu->setCheckable( TRUE ); |
248 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 249 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
249 | populateCategories(); | 250 | populateCategories(); |
250 | mbList->insertItem( tr("View"), catMenu ); | 251 | mbList->insertItem( tr("View"), catMenu ); |
251 | 252 | ||
252 | defaultFont = new QFont( m_abView->font() ); | 253 | defaultFont = new QFont( m_abView->font() ); |
253 | slotSetFont(m_config.fontSize()); | 254 | slotSetFont(m_config.fontSize()); |
254 | m_curFontSize = m_config.fontSize(); | 255 | m_curFontSize = m_config.fontSize(); |
255 | 256 | ||
256 | setCentralWidget(listContainer); | 257 | setCentralWidget(listContainer); |
257 | 258 | ||
258 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 259 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
259 | 260 | ||
260 | 261 | ||
261 | isLoading = false; | 262 | isLoading = false; |
262 | } | 263 | } |
263 | 264 | ||
264 | 265 | ||
265 | void AddressbookWindow::slotConfig() | 266 | void AddressbookWindow::slotConfig() |
266 | { | 267 | { |
267 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); | 268 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); |
268 | dlg -> setConfig( m_config ); | 269 | dlg -> setConfig( m_config ); |
269 | dlg -> showMaximized(); | 270 | dlg -> showMaximized(); |
270 | if ( dlg -> exec() ) { | 271 | if ( dlg -> exec() ) { |
271 | qWarning ("Config Dialog accepted!"); | 272 | qWarning ("Config Dialog accepted!"); |
272 | m_config = dlg -> getConfig(); | 273 | m_config = dlg -> getConfig(); |
273 | if ( m_curFontSize != m_config.fontSize() ){ | 274 | if ( m_curFontSize != m_config.fontSize() ){ |
274 | qWarning("Font was changed!"); | 275 | qWarning("Font was changed!"); |
275 | m_curFontSize = m_config.fontSize(); | 276 | m_curFontSize = m_config.fontSize(); |
276 | emit slotSetFont( m_curFontSize ); | 277 | emit slotSetFont( m_curFontSize ); |
277 | } | 278 | } |
278 | m_abView -> setListOrder( m_config.orderList() ); | 279 | m_abView -> setListOrder( m_config.orderList() ); |
279 | } | 280 | } |
280 | 281 | ||
281 | delete dlg; | 282 | delete dlg; |
282 | } | 283 | } |
283 | 284 | ||
284 | 285 | ||
285 | void AddressbookWindow::slotSetFont( int size ) | 286 | void AddressbookWindow::slotSetFont( int size ) |
286 | { | 287 | { |
287 | qWarning("void AddressbookWindow::slotSetFont( %d )", size); | 288 | qWarning("void AddressbookWindow::slotSetFont( %d )", size); |
288 | 289 | ||
289 | if (size > 2 || size < 0) | 290 | if (size > 2 || size < 0) |
290 | size = 1; | 291 | size = 1; |
291 | 292 | ||
292 | m_config.setFontSize( size ); | 293 | m_config.setFontSize( size ); |
293 | 294 | ||