summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/addressbook.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp27
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,
setCaption( tr("Contacts") );
setIcon( Resource::loadPixmap( "AddressBook" ) );
setToolBarsMovable( FALSE );
- QBoxLayout *vb = new QVBoxLayout( this, 0, 0 );
// Create Toolbars
QPEToolBar *bar = new QPEToolBar( this );
bar->setHorizontalStretchable( TRUE );
QPEMenuBar *mbList = new QPEMenuBar( bar );
@@ -187,14 +186,18 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
tr("There is not enough space to create\n"
"neccessary startup files.\n"
"\nFree up some space before\nentering data!")
);
}
- abList = new AbTable( &orderedFields, this, "table" );
- vb->insertWidget(0,abList);
+ listContainer = new QWidget( this );
+
+ QVBoxLayout *vb = new QVBoxLayout( listContainer );
+
+ abList = new AbTable( &orderedFields, listContainer, "table" );
+ vb->addWidget(abList);
abList->setHScrollBarMode( QScrollView::AlwaysOff );
connect( abList, SIGNAL( empty( bool ) ),
this, SLOT( listIsEmpty( bool ) ) );
connect( abList, SIGNAL( details() ),
this, SLOT( slotListView() ) );
connect( abList, SIGNAL(currentChanged(int,int)),
@@ -205,22 +208,22 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
abList->load( addressbookXMLFilename() );
if ( QFile::exists(addressbookOldXMLFilename()) ) {
abList->load( addressbookOldXMLFilename() );
QFile::remove(addressbookOldXMLFilename());
}
- pLabel = new LetterPicker( abList );
+ pLabel = new LetterPicker( listContainer );
connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char)));
- vb->insertWidget(1,pLabel);
+ vb->addWidget(pLabel);
catMenu = new QPopupMenu( this );
catMenu->setCheckable( TRUE );
connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) );
populateCategories();
mbList->insertItem( tr("View"), catMenu );
- setCentralWidget( abList );
+ setCentralWidget( listContainer );
fontMenu = new QPopupMenu(this);
fontMenu->setCheckable( true );
connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int)));
fontMenu->insertItem(tr( "Small" ), 0);
@@ -229,13 +232,13 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
defaultFont = new QFont( abList->font() );
slotSetFont(startFontSize);
mbList->insertItem( tr("Font"), fontMenu);
- setCentralWidget(abList);
+ setCentralWidget(listContainer);
// qDebug("adressbook contrsuction: t=%d", t.elapsed() );
}
void AddressbookWindow::slotSetFont( int size ) {
if (size > 2 || size < 0)
@@ -291,13 +294,13 @@ void AddressbookWindow::setDocument( const QString &filename )
}
void AddressbookWindow::resizeEvent( QResizeEvent *e )
{
QMainWindow::resizeEvent( e );
- if ( centralWidget() == abList )
+ if ( centralWidget() == listContainer )
showList();
else if ( centralWidget() == mView )
showView();
}
AddressbookWindow::~AddressbookWindow()
@@ -313,22 +316,22 @@ void AddressbookWindow::slotUpdateToolbar()
actionMail->setEnabled( !ce.defaultEmail().isEmpty() );
}
void AddressbookWindow::showList()
{
if ( mView ) mView->hide();
- setCentralWidget( abList );
- abList->show();
+ setCentralWidget( listContainer );
+ listContainer->show();
// update our focues... (or use a stack widget!);
abList->setFocus();
}
void AddressbookWindow::showView()
{
if ( abList->numRows() > 0 ) {
- abList->hide();
+ listContainer->hide();
setCentralWidget( abView() );
mView->show();
mView->setFocus();
}
}
@@ -598,13 +601,13 @@ void AddressbookWindow::slotPersonalView()
Contact me;
if (QFile::exists(filename))
me = Contact::readVCard( filename )[0];
abView()->init( me );
abView()->sync();
- abList->hide();
+ listContainer->hide();
setCentralWidget( abView() );
mView->show();
mView->setFocus();
}
void AddressbookWindow::editEntry( EntryMode entryMode )