summaryrefslogtreecommitdiffabout
path: root/kaddressbook/details/detailsviewcontainer.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/details/detailsviewcontainer.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/details/detailsviewcontainer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp
index 229cce0..cee5886 100644
--- a/kaddressbook/details/detailsviewcontainer.cpp
+++ b/kaddressbook/details/detailsviewcontainer.cpp
@@ -33,96 +33,100 @@
#include "look_basic.h"
//#include "look_details.h"
#include "look_html.h"
#ifdef KAB_EMBEDDED
#include "kabprefs.h"
#endif //KAB_EMBEDDED
#include "detailsviewcontainer.h"
ViewContainer::ViewContainer( QWidget *parent, const char* name )
: QWidget( parent, name ), mCurrentLook( 0 )
{
QBoxLayout *topLayout = new QVBoxLayout( this );
//topLayout->setMargin( KDialog::marginHint() );
//topLayout->setSpacing( KDialog::spacingHint() );
topLayout->setMargin( 0 );
topLayout->setSpacing( 0 );
QBoxLayout *styleLayout = new QHBoxLayout( topLayout );
QLabel *label = new QLabel( i18n("Style:"), this );
styleLayout->addWidget( label );
mStyleCombo = new QComboBox( this );
styleLayout->addWidget( mStyleCombo );
QFrame *frameRuler = new QFrame( this );
//US frameRuler->setFrameShape( QFrame::HLine );
//US frameRuler->setFrameShadow( QFrame::Sunken );
//US topLayout->addWidget( frameRuler );
mDetailsStack = new QWidgetStack( this );
topLayout->addWidget( mDetailsStack, 1 );
registerLooks();
#if 1
// Hide detailed view selection combo box, because we currently have
// only one. Reenable it when there are more detailed views.
label->hide();
mStyleCombo->hide();
frameRuler->hide();
#endif
}
+void ViewContainer::printView()
+{
+ mCurrentLook->printView();
+}
KABBasicLook *ViewContainer::currentLook()
{
return mCurrentLook;
}
void ViewContainer::registerLooks()
{
mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) );
// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) );
mStyleCombo->clear();
for ( uint i = 0; i < mLookFactories.count(); ++i )
mStyleCombo->insertItem( mLookFactories.at( i )->description() );
if ( !mLookFactories.isEmpty() )
slotStyleSelected( 0 );
}
void ViewContainer::slotStyleSelected( int index )
{
#ifndef KAB_EMBEDDED
KConfig *config = kapp->config();
#else //KAB_EMBEDDED
//US I hope I got the same config object as above expected.
KConfig *config = KABPrefs::instance()->getConfig();
#endif //KAB_EMBEDDED
KABC::Addressee addr;
if ( index >= 0 && index < mStyleCombo->count() ) {
if ( mCurrentLook != 0 ) {
mCurrentLook->saveSettings( config );
addr = mCurrentLook->addressee();
delete mCurrentLook;
mCurrentLook = 0;
}
KABLookFactory *factory = mLookFactories.at( index );
mCurrentLook = factory->create();
mDetailsStack->raiseWidget( mCurrentLook );
connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this,
SIGNAL( sendEmail( const QString& ) ) );
connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this,
SIGNAL( browse( const QString& ) ) );
}