Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index e502cf6..beb953a 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -96,13 +96,12 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
96 | 96 | ||
97 | setCaption( tr("Contacts") ); | 97 | setCaption( tr("Contacts") ); |
98 | setIcon( Resource::loadPixmap( "AddressBook" ) ); | 98 | setIcon( Resource::loadPixmap( "AddressBook" ) ); |
99 | 99 | ||
100 | setToolBarsMovable( FALSE ); | 100 | setToolBarsMovable( FALSE ); |
101 | 101 | ||
102 | QBoxLayout *vb = new QVBoxLayout( this, 0, 0 ); | ||
103 | // Create Toolbars | 102 | // Create Toolbars |
104 | 103 | ||
105 | QPEToolBar *bar = new QPEToolBar( this ); | 104 | QPEToolBar *bar = new QPEToolBar( this ); |
106 | bar->setHorizontalStretchable( TRUE ); | 105 | bar->setHorizontalStretchable( TRUE ); |
107 | 106 | ||
108 | QPEMenuBar *mbList = new QPEMenuBar( bar ); | 107 | QPEMenuBar *mbList = new QPEMenuBar( bar ); |
@@ -187,14 +186,18 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
187 | tr("There is not enough space to create\n" | 186 | tr("There is not enough space to create\n" |
188 | "neccessary startup files.\n" | 187 | "neccessary startup files.\n" |
189 | "\nFree up some space before\nentering data!") | 188 | "\nFree up some space before\nentering data!") |
190 | ); | 189 | ); |
191 | } | 190 | } |
192 | 191 | ||
193 | abList = new AbTable( &orderedFields, this, "table" ); | 192 | listContainer = new QWidget( this ); |
194 | vb->insertWidget(0,abList); | 193 | |
194 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | ||
195 | |||
196 | abList = new AbTable( &orderedFields, listContainer, "table" ); | ||
197 | vb->addWidget(abList); | ||
195 | abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 198 | abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
196 | connect( abList, SIGNAL( empty( bool ) ), | 199 | connect( abList, SIGNAL( empty( bool ) ), |
197 | this, SLOT( listIsEmpty( bool ) ) ); | 200 | this, SLOT( listIsEmpty( bool ) ) ); |
198 | connect( abList, SIGNAL( details() ), | 201 | connect( abList, SIGNAL( details() ), |
199 | this, SLOT( slotListView() ) ); | 202 | this, SLOT( slotListView() ) ); |
200 | connect( abList, SIGNAL(currentChanged(int,int)), | 203 | connect( abList, SIGNAL(currentChanged(int,int)), |
@@ -205,22 +208,22 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
205 | abList->load( addressbookXMLFilename() ); | 208 | abList->load( addressbookXMLFilename() ); |
206 | if ( QFile::exists(addressbookOldXMLFilename()) ) { | 209 | if ( QFile::exists(addressbookOldXMLFilename()) ) { |
207 | abList->load( addressbookOldXMLFilename() ); | 210 | abList->load( addressbookOldXMLFilename() ); |
208 | QFile::remove(addressbookOldXMLFilename()); | 211 | QFile::remove(addressbookOldXMLFilename()); |
209 | } | 212 | } |
210 | 213 | ||
211 | pLabel = new LetterPicker( abList ); | 214 | pLabel = new LetterPicker( listContainer ); |
212 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 215 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
213 | vb->insertWidget(1,pLabel); | 216 | vb->addWidget(pLabel); |
214 | catMenu = new QPopupMenu( this ); | 217 | catMenu = new QPopupMenu( this ); |
215 | catMenu->setCheckable( TRUE ); | 218 | catMenu->setCheckable( TRUE ); |
216 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 219 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
217 | populateCategories(); | 220 | populateCategories(); |
218 | 221 | ||
219 | mbList->insertItem( tr("View"), catMenu ); | 222 | mbList->insertItem( tr("View"), catMenu ); |
220 | setCentralWidget( abList ); | 223 | setCentralWidget( listContainer ); |
221 | 224 | ||
222 | fontMenu = new QPopupMenu(this); | 225 | fontMenu = new QPopupMenu(this); |
223 | fontMenu->setCheckable( true ); | 226 | fontMenu->setCheckable( true ); |
224 | connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); | 227 | connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); |
225 | 228 | ||
226 | fontMenu->insertItem(tr( "Small" ), 0); | 229 | fontMenu->insertItem(tr( "Small" ), 0); |
@@ -229,13 +232,13 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
229 | 232 | ||
230 | defaultFont = new QFont( abList->font() ); | 233 | defaultFont = new QFont( abList->font() ); |
231 | 234 | ||
232 | slotSetFont(startFontSize); | 235 | slotSetFont(startFontSize); |
233 | 236 | ||
234 | mbList->insertItem( tr("Font"), fontMenu); | 237 | mbList->insertItem( tr("Font"), fontMenu); |
235 | setCentralWidget(abList); | 238 | setCentralWidget(listContainer); |
236 | 239 | ||
237 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 240 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
238 | } | 241 | } |
239 | void AddressbookWindow::slotSetFont( int size ) { | 242 | void AddressbookWindow::slotSetFont( int size ) { |
240 | 243 | ||
241 | if (size > 2 || size < 0) | 244 | if (size > 2 || size < 0) |
@@ -291,13 +294,13 @@ void AddressbookWindow::setDocument( const QString &filename ) | |||
291 | } | 294 | } |
292 | 295 | ||
293 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 296 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
294 | { | 297 | { |
295 | QMainWindow::resizeEvent( e ); | 298 | QMainWindow::resizeEvent( e ); |
296 | 299 | ||
297 | if ( centralWidget() == abList ) | 300 | if ( centralWidget() == listContainer ) |
298 | showList(); | 301 | showList(); |
299 | else if ( centralWidget() == mView ) | 302 | else if ( centralWidget() == mView ) |
300 | showView(); | 303 | showView(); |
301 | } | 304 | } |
302 | 305 | ||
303 | AddressbookWindow::~AddressbookWindow() | 306 | AddressbookWindow::~AddressbookWindow() |
@@ -313,22 +316,22 @@ void AddressbookWindow::slotUpdateToolbar() | |||
313 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 316 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
314 | } | 317 | } |
315 | 318 | ||
316 | void AddressbookWindow::showList() | 319 | void AddressbookWindow::showList() |
317 | { | 320 | { |
318 | if ( mView ) mView->hide(); | 321 | if ( mView ) mView->hide(); |
319 | setCentralWidget( abList ); | 322 | setCentralWidget( listContainer ); |
320 | abList->show(); | 323 | listContainer->show(); |
321 | // update our focues... (or use a stack widget!); | 324 | // update our focues... (or use a stack widget!); |
322 | abList->setFocus(); | 325 | abList->setFocus(); |
323 | } | 326 | } |
324 | 327 | ||
325 | void AddressbookWindow::showView() | 328 | void AddressbookWindow::showView() |
326 | { | 329 | { |
327 | if ( abList->numRows() > 0 ) { | 330 | if ( abList->numRows() > 0 ) { |
328 | abList->hide(); | 331 | listContainer->hide(); |
329 | setCentralWidget( abView() ); | 332 | setCentralWidget( abView() ); |
330 | mView->show(); | 333 | mView->show(); |
331 | mView->setFocus(); | 334 | mView->setFocus(); |
332 | } | 335 | } |
333 | } | 336 | } |
334 | 337 | ||
@@ -598,13 +601,13 @@ void AddressbookWindow::slotPersonalView() | |||
598 | Contact me; | 601 | Contact me; |
599 | if (QFile::exists(filename)) | 602 | if (QFile::exists(filename)) |
600 | me = Contact::readVCard( filename )[0]; | 603 | me = Contact::readVCard( filename )[0]; |
601 | 604 | ||
602 | abView()->init( me ); | 605 | abView()->init( me ); |
603 | abView()->sync(); | 606 | abView()->sync(); |
604 | abList->hide(); | 607 | listContainer->hide(); |
605 | setCentralWidget( abView() ); | 608 | setCentralWidget( abView() ); |
606 | mView->show(); | 609 | mView->show(); |
607 | mView->setFocus(); | 610 | mView->setFocus(); |
608 | } | 611 | } |
609 | 612 | ||
610 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 613 | void AddressbookWindow::editEntry( EntryMode entryMode ) |