summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 95a8521..360aa7e 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -92,259 +92,259 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
92 syncing(FALSE) 92 syncing(FALSE)
93{ 93{
94 initFields(); 94 initFields();
95 95
96 setCaption( tr("Contacts") ); 96 setCaption( tr("Contacts") );
97 setIcon( Resource::loadPixmap( "AddressBook" ) ); 97 setIcon( Resource::loadPixmap( "AddressBook" ) );
98 98
99 setToolBarsMovable( FALSE ); 99 setToolBarsMovable( FALSE );
100 100
101 // Create Toolbars 101 // Create Toolbars
102 102
103 QPEToolBar *bar = new QPEToolBar( this ); 103 QPEToolBar *bar = new QPEToolBar( this );
104 bar->setHorizontalStretchable( TRUE ); 104 bar->setHorizontalStretchable( TRUE );
105 105
106 QPEMenuBar *mbList = new QPEMenuBar( bar ); 106 QPEMenuBar *mbList = new QPEMenuBar( bar );
107 mbList->setMargin( 0 ); 107 mbList->setMargin( 0 );
108 108
109 QPopupMenu *edit = new QPopupMenu( this ); 109 QPopupMenu *edit = new QPopupMenu( this );
110 mbList->insertItem( tr( "Contact" ), edit ); 110 mbList->insertItem( tr( "Contact" ), edit );
111 111
112 listTools = new QPEToolBar( this, "list operations" ); 112 listTools = new QPEToolBar( this, "list operations" );
113 113
114 114
115 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 115 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null,
116 0, this, 0 ); 116 0, this, 0 );
117 actionNew = a; 117 actionNew = a;
118 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); 118 connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) );
119 a->addTo( edit ); 119 a->addTo( edit );
120 a->addTo( listTools ); 120 a->addTo( listTools );
121 121
122 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 122 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null,
123 0, this, 0 ); 123 0, this, 0 );
124 actionEdit = a; 124 actionEdit = a;
125 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); 125 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) );
126 a->addTo( edit ); 126 a->addTo( edit );
127 a->addTo( listTools ); 127 a->addTo( listTools );
128 128
129 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 129 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null,
130 0, this, 0 ); 130 0, this, 0 );
131 actionTrash = a; 131 actionTrash = a;
132 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); 132 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) );
133 a->addTo( edit ); 133 a->addTo( edit );
134 a->addTo( listTools ); 134 a->addTo( listTools );
135 135
136#ifndef MAKE_FOR_SHARP_ROM 136#ifndef MAKE_FOR_SHARP_ROM
137 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), 137 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ),
138 QString::null, 0, this, 0 ); 138 QString::null, 0, this, 0 );
139 actionFind = a; 139 actionFind = a;
140 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); 140 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
141 a->addTo( edit ); 141 a->addTo( edit );
142 a->addTo( listTools ); 142 a->addTo( listTools );
143#endif 143#endif
144 144
145 145
146 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), 146 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ),
147 QString::null, 0, this, 0 ); 147 QString::null, 0, this, 0 );
148 //a->setEnabled( FALSE ); we got support for it now :) zecke 148 //a->setEnabled( FALSE ); we got support for it now :) zecke
149 actionMail = a; 149 actionMail = a;
150 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); 150 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) );
151 a->addTo( edit ); 151 a->addTo( edit );
152 a->addTo( listTools ); 152 a->addTo( listTools );
153 153
154 154
155 155
156 if ( Ir::supported() ) { 156 if ( Ir::supported() ) {
157 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, 157 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null,
158 0, this, 0 ); 158 0, this, 0 );
159 actionBeam = a; 159 actionBeam = a;
160 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); 160 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) );
161 a->addTo( edit ); 161 a->addTo( edit );
162 a->addTo( listTools ); 162 a->addTo( listTools );
163 } 163 }
164 164
165 edit->insertSeparator(); 165 edit->insertSeparator();
166 166
167 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); 167 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE );
168 actionPersonal = a; 168 actionPersonal = a;
169 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); 169 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) );
170 a->addTo( edit ); 170 a->addTo( edit );
171 171
172 172
173 a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); 173 a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 );
174 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 174 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
175 a->addTo( edit ); 175 a->addTo( edit );
176 176
177 // Create Views 177 // Create Views
178 178
179 // This is safe to call without checking to see if it exists... 179 // This is safe to call without checking to see if it exists...
180 // not to mention it also does the necessary stuff for the 180 // not to mention it also does the necessary stuff for the
181 // journaling... 181 // journaling...
182 QString str = addressbookXMLFilename(); 182 QString str = addressbookXMLFilename();
183 if ( str.isNull() ) { 183 if ( str.isNull() ) {
184 QMessageBox::warning( this, tr("Out of Space"), 184 QMessageBox::warning( this, tr("Out of Space"),
185 tr("There is not enough space to create\n" 185 tr("There is not enough space to create\n"
186 "neccessary startup files.\n" 186 "neccessary startup files.\n"
187 "\nFree up some space before\nentering data!") 187 "\nFree up some space before\nentering data!")
188 ); 188 );
189 } 189 }
190 190
191 abList = new AbTable( &orderedFields, this, "table" ); 191 abList = new AbTable( &orderedFields, this, "table" );
192 abList->setHScrollBarMode( QScrollView::AlwaysOff ); 192 abList->setHScrollBarMode( QScrollView::AlwaysOff );
193 connect( abList, SIGNAL( empty( bool ) ), 193 connect( abList, SIGNAL( empty( bool ) ),
194 this, SLOT( listIsEmpty( bool ) ) ); 194 this, SLOT( listIsEmpty( bool ) ) );
195 connect( abList, SIGNAL( details() ), 195 connect( abList, SIGNAL( details() ),
196 this, SLOT( slotListView() ) ); 196 this, SLOT( slotListView() ) );
197 connect( abList, SIGNAL(currentChanged(int,int)), 197 connect( abList, SIGNAL(currentChanged(int,int)),
198 this, SLOT(slotUpdateToolbar()) ); 198 this, SLOT(slotUpdateToolbar()) );
199 199
200 mView = 0; 200 mView = 0;
201 201
202 abList->load( addressbookXMLFilename() ); 202 abList->load( addressbookXMLFilename() );
203 if ( QFile::exists(addressbookOldXMLFilename()) ) { 203 if ( QFile::exists(addressbookOldXMLFilename()) ) {
204 abList->load( addressbookOldXMLFilename() ); 204 abList->load( addressbookOldXMLFilename() );
205 QFile::remove(addressbookOldXMLFilename()); 205 QFile::remove(addressbookOldXMLFilename());
206 } 206 }
207 207
208 catMenu = new QPopupMenu( this ); 208 catMenu = new QPopupMenu( this );
209 catMenu->setCheckable( TRUE ); 209 catMenu->setCheckable( TRUE );
210 connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); 210 connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) );
211 populateCategories(); 211 populateCategories();
212 212
213 mbList->insertItem( tr("View"), catMenu ); 213 mbList->insertItem( tr("View"), catMenu );
214 setCentralWidget( abList ); 214 setCentralWidget( abList );
215 215
216 fontMenu = new QPopupMenu(this); 216 fontMenu = new QPopupMenu(this);
217 fontMenu->setCheckable( true ); 217 fontMenu->setCheckable( true );
218 connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); 218 connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int)));
219 219
220 fontMenu->insertItem("Small", 0); 220 fontMenu->insertItem(tr( "Small" ), 0);
221 fontMenu->insertItem("Normal", 1); 221 fontMenu->insertItem(tr( "Normal" ), 1);
222 fontMenu->insertItem("Large", 2); 222 fontMenu->insertItem(tr( "Large" ), 2);
223 223
224 defaultFont = new QFont( abList->font() ); 224 defaultFont = new QFont( abList->font() );
225 225
226 slotSetFont(startFontSize); 226 slotSetFont(startFontSize);
227 227
228 mbList->insertItem( tr("Font"), fontMenu); 228 mbList->insertItem( tr("Font"), fontMenu);
229 setCentralWidget(abList); 229 setCentralWidget(abList);
230 230
231 // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); 231 // qDebug("adressbook contrsuction: t=%d", t.elapsed() );
232} 232}
233void AddressbookWindow::slotSetFont( int size ) { 233void AddressbookWindow::slotSetFont( int size ) {
234 234
235 if (size > 2 || size < 0) 235 if (size > 2 || size < 0)
236 size = 1; 236 size = 1;
237 237
238 startFontSize = size; 238 startFontSize = size;
239 239
240 QFont *currentFont; 240 QFont *currentFont;
241 241
242 switch (size) { 242 switch (size) {
243 case 0: 243 case 0:
244 fontMenu->setItemChecked(0, true); 244 fontMenu->setItemChecked(0, true);
245 fontMenu->setItemChecked(1, false); 245 fontMenu->setItemChecked(1, false);
246 fontMenu->setItemChecked(2, false); 246 fontMenu->setItemChecked(2, false);
247 abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); 247 abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) );
248 currentFont = new QFont (abList->font()); 248 currentFont = new QFont (abList->font());
249 abList->resizeRows(currentFont->pixelSize() + 7); 249 abList->resizeRows(currentFont->pixelSize() + 7);
250 break; 250 break;
251 case 1: 251 case 1:
252 fontMenu->setItemChecked(0, false); 252 fontMenu->setItemChecked(0, false);
253 fontMenu->setItemChecked(1, true); 253 fontMenu->setItemChecked(1, true);
254 fontMenu->setItemChecked(2, false); 254 fontMenu->setItemChecked(2, false);
255 abList->setFont( *defaultFont ); 255 abList->setFont( *defaultFont );
256 currentFont = new QFont (abList->font()); 256 currentFont = new QFont (abList->font());
257 abList->resizeRows(currentFont->pixelSize() + 7); 257 abList->resizeRows(currentFont->pixelSize() + 7);
258 break; 258 break;
259 case 2: 259 case 2:
260 fontMenu->setItemChecked(0, false); 260 fontMenu->setItemChecked(0, false);
261 fontMenu->setItemChecked(1, false); 261 fontMenu->setItemChecked(1, false);
262 fontMenu->setItemChecked(2, true); 262 fontMenu->setItemChecked(2, true);
263 abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); 263 abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) );
264 currentFont = new QFont (abList->font()); 264 currentFont = new QFont (abList->font());
265 abList->resizeRows(currentFont->pixelSize() + 7); 265 abList->resizeRows(currentFont->pixelSize() + 7);
266 break; 266 break;
267 } 267 }
268} 268}
269 269
270 270
271void AddressbookWindow::setDocument( const QString &filename ) 271void AddressbookWindow::setDocument( const QString &filename )
272{ 272{
273 if ( filename.find(".vcf") != int(filename.length()) - 4 ) return; 273 if ( filename.find(".vcf") != int(filename.length()) - 4 ) return;
274 274
275 QValueList<Contact> cl = Contact::readVCard( filename ); 275 QValueList<Contact> cl = Contact::readVCard( filename );
276 for( QValueList<Contact>::Iterator it = cl.begin(); it != cl.end(); ++it ) { 276 for( QValueList<Contact>::Iterator it = cl.begin(); it != cl.end(); ++it ) {
277 // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?") 277 // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?")
278 // .arg( (*it).fullName() ); 278 // .arg( (*it).fullName() );
279 // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == 279 // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) ==
280 // QMessageBox::Ok ) { 280 // QMessageBox::Ok ) {
281 abList->addEntry( *it ); 281 abList->addEntry( *it );
282 // } 282 // }
283 } 283 }
284 284
285} 285}
286 286
287void AddressbookWindow::resizeEvent( QResizeEvent *e ) 287void AddressbookWindow::resizeEvent( QResizeEvent *e )
288{ 288{
289 QMainWindow::resizeEvent( e ); 289 QMainWindow::resizeEvent( e );
290 290
291 if ( centralWidget() == abList ) 291 if ( centralWidget() == abList )
292 showList(); 292 showList();
293 else if ( centralWidget() == mView ) 293 else if ( centralWidget() == mView )
294 showView(); 294 showView();
295} 295}
296 296
297AddressbookWindow::~AddressbookWindow() 297AddressbookWindow::~AddressbookWindow()
298{ 298{
299 Config cfg("AddressBook"); 299 Config cfg("AddressBook");
300 cfg.setGroup("Font"); 300 cfg.setGroup("Font");
301 cfg.writeEntry("fontSize", startFontSize); 301 cfg.writeEntry("fontSize", startFontSize);
302} 302}
303 303
304void AddressbookWindow::slotUpdateToolbar() 304void AddressbookWindow::slotUpdateToolbar()
305{ 305{
306 Contact ce = abList->currentEntry(); 306 Contact ce = abList->currentEntry();
307 actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); 307 actionMail->setEnabled( !ce.defaultEmail().isEmpty() );
308} 308}
309 309
310void AddressbookWindow::showList() 310void AddressbookWindow::showList()
311{ 311{
312 if ( mView ) mView->hide(); 312 if ( mView ) mView->hide();
313 setCentralWidget( abList ); 313 setCentralWidget( abList );
314 abList->show(); 314 abList->show();
315 // update our focues... (or use a stack widget!); 315 // update our focues... (or use a stack widget!);
316 abList->setFocus(); 316 abList->setFocus();
317} 317}
318 318
319void AddressbookWindow::showView() 319void AddressbookWindow::showView()
320{ 320{
321 if ( abList->numRows() > 0 ) { 321 if ( abList->numRows() > 0 ) {
322 abList->hide(); 322 abList->hide();
323 setCentralWidget( abView() ); 323 setCentralWidget( abView() );
324 mView->show(); 324 mView->show();
325 mView->setFocus(); 325 mView->setFocus();
326 } 326 }
327} 327}
328 328
329void AddressbookWindow::slotListNew() 329void AddressbookWindow::slotListNew()
330{ 330{
331 Contact cnt; 331 Contact cnt;
332 if( !syncing ) { 332 if( !syncing ) {
333 if ( abEditor ) 333 if ( abEditor )
334 abEditor->setEntry( cnt ); 334 abEditor->setEntry( cnt );
335 abView()->init( cnt ); 335 abView()->init( cnt );
336 editEntry( NewEntry ); 336 editEntry( NewEntry );
337 } else { 337 } else {
338 QMessageBox::warning(this, tr("Contacts"), 338 QMessageBox::warning(this, tr("Contacts"),
339 tr("Can not edit data, currently syncing")); 339 tr("Can not edit data, currently syncing"));
340 } 340 }
341} 341}
342 342
343void AddressbookWindow::slotListView() 343void AddressbookWindow::slotListView()
344{ 344{
345 abView()->init( abList->currentEntry() ); 345 abView()->init( abList->currentEntry() );
346 mView->sync(); 346 mView->sync();
347 showView(); 347 showView();
348} 348}
349 349
350void AddressbookWindow::slotListDelete() 350void AddressbookWindow::slotListDelete()