summaryrefslogtreecommitdiffabout
path: root/kaddressbook/details
authorzautrix <zautrix>2004-10-13 02:34:50 (UTC)
committer zautrix <zautrix>2004-10-13 02:34:50 (UTC)
commite7833b80c28e38bfe6316ee5fce150635cdebe03 (patch) (unidiff)
treebc52de370428ef240e370da516077e883283d398 /kaddressbook/details
parentd56ca1073ce493afdeb54e33425638f7147d4bca (diff)
downloadkdepimpi-e7833b80c28e38bfe6316ee5fce150635cdebe03.zip
kdepimpi-e7833b80c28e38bfe6316ee5fce150635cdebe03.tar.gz
kdepimpi-e7833b80c28e38bfe6316ee5fce150635cdebe03.tar.bz2
added font setting in KA
Diffstat (limited to 'kaddressbook/details') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/details/detailsviewcontainer.cpp3
-rw-r--r--kaddressbook/details/look_html.cpp3
2 files changed, 3 insertions, 3 deletions
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp
index a42499f..ceffc77 100644
--- a/kaddressbook/details/detailsviewcontainer.cpp
+++ b/kaddressbook/details/detailsviewcontainer.cpp
@@ -23,150 +23,147 @@
23 23
24#include <qcombobox.h> 24#include <qcombobox.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29 29
30#include <kapplication.h> 30#include <kapplication.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kdialog.h> 32#include <kdialog.h>
33 33
34#include "look_basic.h" 34#include "look_basic.h"
35//#include "look_details.h" 35//#include "look_details.h"
36#include "look_html.h" 36#include "look_html.h"
37 37
38#ifdef KAB_EMBEDDED 38#ifdef KAB_EMBEDDED
39#include "kabprefs.h" 39#include "kabprefs.h"
40#endif //KAB_EMBEDDED 40#endif //KAB_EMBEDDED
41 41
42 42
43#include "detailsviewcontainer.h" 43#include "detailsviewcontainer.h"
44 44
45ViewContainer::ViewContainer( QWidget *parent, const char* name ) 45ViewContainer::ViewContainer( QWidget *parent, const char* name )
46 : QWidget( parent, name ), mCurrentLook( 0 ) 46 : QWidget( parent, name ), mCurrentLook( 0 )
47{ 47{
48 QBoxLayout *topLayout = new QVBoxLayout( this ); 48 QBoxLayout *topLayout = new QVBoxLayout( this );
49 //topLayout->setMargin( KDialog::marginHint() ); 49 //topLayout->setMargin( KDialog::marginHint() );
50 //topLayout->setSpacing( KDialog::spacingHint() ); 50 //topLayout->setSpacing( KDialog::spacingHint() );
51 topLayout->setMargin( 0 ); 51 topLayout->setMargin( 0 );
52 topLayout->setSpacing( 0 ); 52 topLayout->setSpacing( 0 );
53 53
54 QBoxLayout *styleLayout = new QHBoxLayout( topLayout ); 54 QBoxLayout *styleLayout = new QHBoxLayout( topLayout );
55 55
56 QLabel *label = new QLabel( i18n("Style:"), this ); 56 QLabel *label = new QLabel( i18n("Style:"), this );
57 styleLayout->addWidget( label ); 57 styleLayout->addWidget( label );
58 58
59 mStyleCombo = new QComboBox( this ); 59 mStyleCombo = new QComboBox( this );
60 styleLayout->addWidget( mStyleCombo ); 60 styleLayout->addWidget( mStyleCombo );
61 61
62 QFrame *frameRuler = new QFrame( this ); 62 QFrame *frameRuler = new QFrame( this );
63//US frameRuler->setFrameShape( QFrame::HLine ); 63//US frameRuler->setFrameShape( QFrame::HLine );
64//US frameRuler->setFrameShadow( QFrame::Sunken ); 64//US frameRuler->setFrameShadow( QFrame::Sunken );
65//US topLayout->addWidget( frameRuler ); 65//US topLayout->addWidget( frameRuler );
66 66
67 mDetailsStack = new QWidgetStack( this ); 67 mDetailsStack = new QWidgetStack( this );
68 topLayout->addWidget( mDetailsStack, 1 ); 68 topLayout->addWidget( mDetailsStack, 1 );
69 69
70 registerLooks(); 70 registerLooks();
71 71
72#if 1 72#if 1
73 // Hide detailed view selection combo box, because we currently have 73 // Hide detailed view selection combo box, because we currently have
74 // only one. Reenable it when there are more detailed views. 74 // only one. Reenable it when there are more detailed views.
75 label->hide(); 75 label->hide();
76 mStyleCombo->hide(); 76 mStyleCombo->hide();
77 frameRuler->hide(); 77 frameRuler->hide();
78#endif 78#endif
79} 79}
80 80
81KABBasicLook *ViewContainer::currentLook() 81KABBasicLook *ViewContainer::currentLook()
82{ 82{
83 return mCurrentLook; 83 return mCurrentLook;
84} 84}
85 85
86void ViewContainer::registerLooks() 86void ViewContainer::registerLooks()
87{ 87{
88 mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) ); 88 mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) );
89// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) ); 89// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) );
90 mStyleCombo->clear(); 90 mStyleCombo->clear();
91 91
92 for ( uint i = 0; i < mLookFactories.count(); ++i ) 92 for ( uint i = 0; i < mLookFactories.count(); ++i )
93 mStyleCombo->insertItem( mLookFactories.at( i )->description() ); 93 mStyleCombo->insertItem( mLookFactories.at( i )->description() );
94 94
95 if ( !mLookFactories.isEmpty() ) 95 if ( !mLookFactories.isEmpty() )
96 slotStyleSelected( 0 ); 96 slotStyleSelected( 0 );
97} 97}
98 98
99void ViewContainer::slotStyleSelected( int index ) 99void ViewContainer::slotStyleSelected( int index )
100{ 100{
101#ifndef KAB_EMBEDDED 101#ifndef KAB_EMBEDDED
102 KConfig *config = kapp->config(); 102 KConfig *config = kapp->config();
103#else //KAB_EMBEDDED 103#else //KAB_EMBEDDED
104 //US I hope I got the same config object as above expected. 104 //US I hope I got the same config object as above expected.
105 KConfig *config = KABPrefs::instance()->getConfig(); 105 KConfig *config = KABPrefs::instance()->getConfig();
106#endif //KAB_EMBEDDED 106#endif //KAB_EMBEDDED
107 KABC::Addressee addr; 107 KABC::Addressee addr;
108 108
109 if ( index >= 0 && index < mStyleCombo->count() ) { 109 if ( index >= 0 && index < mStyleCombo->count() ) {
110 if ( mCurrentLook != 0 ) { 110 if ( mCurrentLook != 0 ) {
111 mCurrentLook->saveSettings( config ); 111 mCurrentLook->saveSettings( config );
112 addr = mCurrentLook->addressee(); 112 addr = mCurrentLook->addressee();
113 113
114 delete mCurrentLook; 114 delete mCurrentLook;
115 mCurrentLook = 0; 115 mCurrentLook = 0;
116 } 116 }
117 117
118 KABLookFactory *factory = mLookFactories.at( index ); 118 KABLookFactory *factory = mLookFactories.at( index );
119 kdDebug(5720) << "ViewContainer::slotStyleSelected: "
120 << "creating look "
121 << factory->description() << endl;
122 119
123 mCurrentLook = factory->create(); 120 mCurrentLook = factory->create();
124 mDetailsStack->raiseWidget( mCurrentLook ); 121 mDetailsStack->raiseWidget( mCurrentLook );
125 122
126 connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, 123 connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this,
127 SIGNAL( sendEmail( const QString& ) ) ); 124 SIGNAL( sendEmail( const QString& ) ) );
128 connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, 125 connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this,
129 SIGNAL( browse( const QString& ) ) ); 126 SIGNAL( browse( const QString& ) ) );
130 } 127 }
131 128
132 mCurrentLook->restoreSettings( config ); 129 mCurrentLook->restoreSettings( config );
133 mCurrentLook->setAddressee( addr ); 130 mCurrentLook->setAddressee( addr );
134} 131}
135void ViewContainer::refreshView() 132void ViewContainer::refreshView()
136{ 133{
137 if ( mCurrentLook ) { 134 if ( mCurrentLook ) {
138 mCurrentLook->setAddressee( mCurrentAddressee ); 135 mCurrentLook->setAddressee( mCurrentAddressee );
139 } 136 }
140} 137}
141 138
142void ViewContainer::setAddressee( const KABC::Addressee& addressee ) 139void ViewContainer::setAddressee( const KABC::Addressee& addressee )
143{ 140{
144 if ( mCurrentLook != 0 ) { 141 if ( mCurrentLook != 0 ) {
145 if ( addressee == mCurrentAddressee ) 142 if ( addressee == mCurrentAddressee )
146 return; 143 return;
147 else { 144 else {
148 mCurrentAddressee = addressee; 145 mCurrentAddressee = addressee;
149 mCurrentLook->setAddressee( mCurrentAddressee ); 146 mCurrentLook->setAddressee( mCurrentAddressee );
150 } 147 }
151 } 148 }
152} 149}
153 150
154KABC::Addressee ViewContainer::addressee() 151KABC::Addressee ViewContainer::addressee()
155{ 152{
156 static KABC::Addressee empty; // do not use! 153 static KABC::Addressee empty; // do not use!
157 154
158 if ( !mCurrentLook ) 155 if ( !mCurrentLook )
159 return empty; 156 return empty;
160 else 157 else
161 return mCurrentLook->addressee(); 158 return mCurrentLook->addressee();
162} 159}
163 160
164void ViewContainer::setReadOnly( bool state ) 161void ViewContainer::setReadOnly( bool state )
165{ 162{
166 if ( mCurrentLook ) 163 if ( mCurrentLook )
167 mCurrentLook->setReadOnly( state ); 164 mCurrentLook->setReadOnly( state );
168} 165}
169 166
170#ifndef KAB_EMBEDDED 167#ifndef KAB_EMBEDDED
171#include "detailsviewcontainer.moc" 168#include "detailsviewcontainer.moc"
172#endif //KAB_EMBEDDED 169#endif //KAB_EMBEDDED
diff --git a/kaddressbook/details/look_html.cpp b/kaddressbook/details/look_html.cpp
index 63364a7..64987b8 100644
--- a/kaddressbook/details/look_html.cpp
+++ b/kaddressbook/details/look_html.cpp
@@ -1,45 +1,48 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <addresseeview.h> 24#include <addresseeview.h>
25 25
26#include "look_html.h" 26#include "look_html.h"
27#include <qscrollview.h> 27#include <qscrollview.h>
28#include "kabprefs.h"
28KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) 29KABHtmlView::KABHtmlView( QWidget *parent, const char *name )
29 : KABBasicLook( parent, name ) 30 : KABBasicLook( parent, name )
30{ 31{
31 mView = new KPIM::AddresseeView( this ); 32 mView = new KPIM::AddresseeView( this );
33 mView->setFont( KABPrefs::instance()->mDetailsFont );
32} 34}
33 35
34KABHtmlView::~KABHtmlView() 36KABHtmlView::~KABHtmlView()
35{ 37{
36} 38}
37 39
38void KABHtmlView::setAddressee( const KABC::Addressee &addr ) 40void KABHtmlView::setAddressee( const KABC::Addressee &addr )
39{ 41{
42 mView->setFont( KABPrefs::instance()->mDetailsFont );
40 mView->setAddressee( addr ); 43 mView->setAddressee( addr );
41} 44}
42 45
43#ifndef KAB_EMBEDDED 46#ifndef KAB_EMBEDDED
44#include "look_html.moc" 47#include "look_html.moc"
45#endif //KAB_EMBEDDED 48#endif //KAB_EMBEDDED