summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-13 02:34:50 (UTC)
committer zautrix <zautrix>2004-10-13 02:34:50 (UTC)
commite7833b80c28e38bfe6316ee5fce150635cdebe03 (patch) (unidiff)
treebc52de370428ef240e370da516077e883283d398
parentd56ca1073ce493afdeb54e33425638f7147d4bca (diff)
downloadkdepimpi-e7833b80c28e38bfe6316ee5fce150635cdebe03.zip
kdepimpi-e7833b80c28e38bfe6316ee5fce150635cdebe03.tar.gz
kdepimpi-e7833b80c28e38bfe6316ee5fce150635cdebe03.tar.bz2
added font setting in KA
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/details/detailsviewcontainer.cpp3
-rw-r--r--kaddressbook/details/look_html.cpp3
-rw-r--r--kaddressbook/kabprefs.cpp2
-rw-r--r--kaddressbook/kabprefs.h1
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp13
5 files changed, 19 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
@@ -95,51 +95,48 @@ void ViewContainer::registerLooks()
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 )
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
@@ -4,42 +4,45 @@
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
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index dded2bf..9270a7d 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -18,60 +18,62 @@
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//US#ifdef KAB_EMBEDDED 24//US#ifdef KAB_EMBEDDED
25//#include <qstring.h> 25//#include <qstring.h>
26//#endif //KAB_EMBEDDED 26//#endif //KAB_EMBEDDED
27 27
28 28
29#include <kconfig.h> 29#include <kconfig.h>
30#include <klocale.h> 30#include <klocale.h>
31#include <kstaticdeleter.h> 31#include <kstaticdeleter.h>
32//US#include <kdebug.h> // defines kdDebug() 32//US#include <kdebug.h> // defines kdDebug()
33 33
34#include "kabprefs.h" 34#include "kabprefs.h"
35 35
36KABPrefs *KABPrefs::sInstance = 0; 36KABPrefs *KABPrefs::sInstance = 0;
37static KStaticDeleter<KABPrefs> staticDeleter; 37static KStaticDeleter<KABPrefs> staticDeleter;
38 38
39KABPrefs::KABPrefs() 39KABPrefs::KABPrefs()
40 : KPimPrefs("kaddressbookrc") 40 : KPimPrefs("kaddressbookrc")
41{ 41{
42 mDetailsFont = QFont("helvetica",12);
42 KPrefs::setCurrentGroup( "Views" ); 43 KPrefs::setCurrentGroup( "Views" );
43 addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); 44 addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
44 45
45 KPrefs::setCurrentGroup( "General" ); 46 KPrefs::setCurrentGroup( "General" );
46 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); 47 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true );
47 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); 48 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 );
48 49
49#ifdef KAB_EMBEDDED 50#ifdef KAB_EMBEDDED
50 addItemBool("AskForQuit",&mAskForQuit,true); 51 addItemBool("AskForQuit",&mAskForQuit,true);
51 addItemBool("ToolBarHor",&mToolBarHor, true ); 52 addItemBool("ToolBarHor",&mToolBarHor, true );
52 addItemBool("ToolBarUp",&mToolBarUp, false ); 53 addItemBool("ToolBarUp",&mToolBarUp, false );
53 addItemBool("SearchWithReturn",&mSearchWithReturn, true ); 54 addItemBool("SearchWithReturn",&mSearchWithReturn, true );
55 addItemFont("DetailsFont",&mDetailsFont);
54 56
55 57
56#endif //KAB_EMBEDDED 58#endif //KAB_EMBEDDED
57 59
58 KPrefs::setCurrentGroup( "MainWindow" ); 60 KPrefs::setCurrentGroup( "MainWindow" );
59 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); 61 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false );
60 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); 62 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true );
61 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); 63 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter );
62 addItemIntList( "DetailsSplitter", &mDetailsSplitter ); 64 addItemIntList( "DetailsSplitter", &mDetailsSplitter );
63 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); 65 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true );
64 66
65 67
66 KPrefs::setCurrentGroup( "Extensions_General" ); 68 KPrefs::setCurrentGroup( "Extensions_General" );
67 QStringList defaultExtensions; 69 QStringList defaultExtensions;
68 defaultExtensions << "merge"; 70 defaultExtensions << "merge";
69 defaultExtensions << "distribution_list_editor"; 71 defaultExtensions << "distribution_list_editor";
70 addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); 72 addItemInt( "CurrentExtension", &mCurrentExtension, 0 );
71 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); 73 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions );
72 74
73 KPrefs::setCurrentGroup( "Views" ); 75 KPrefs::setCurrentGroup( "Views" );
74 QString defaultView = i18n( "Default Table View" ); 76 QString defaultView = i18n( "Default Table View" );
75 addItemString( "CurrentView", &mCurrentView, defaultView ); 77 addItemString( "CurrentView", &mCurrentView, defaultView );
76 addItemStringList( "ViewNames", &mViewNames, defaultView ); 78 addItemStringList( "ViewNames", &mViewNames, defaultView );
77 79
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h
index e4f359c..4a3b6e2 100644
--- a/kaddressbook/kabprefs.h
+++ b/kaddressbook/kabprefs.h
@@ -61,32 +61,33 @@ class KABPrefs : public KPimPrefs
61// void usrWriteConfig(); 61// void usrWriteConfig();
62#endif //KAB_EMBEDDED 62#endif //KAB_EMBEDDED
63 63
64 64
65 // GUI 65 // GUI
66 bool mJumpButtonBarVisible; 66 bool mJumpButtonBarVisible;
67 bool mDetailsPageVisible; 67 bool mDetailsPageVisible;
68 bool mMultipleViewsAtOnce; 68 bool mMultipleViewsAtOnce;
69 bool mSearchWithReturn; 69 bool mSearchWithReturn;
70 QValueList<int> mExtensionsSplitter; 70 QValueList<int> mExtensionsSplitter;
71 QValueList<int> mDetailsSplitter; 71 QValueList<int> mDetailsSplitter;
72 72
73 // Extensions stuff 73 // Extensions stuff
74 int mCurrentExtension; 74 int mCurrentExtension;
75 QStringList mActiveExtensions; 75 QStringList mActiveExtensions;
76 76
77 // Views stuff 77 // Views stuff
78 QString mCurrentView; 78 QString mCurrentView;
79 QStringList mViewNames; 79 QStringList mViewNames;
80 80
81 // Filter 81 // Filter
82 int mCurrentFilter; 82 int mCurrentFilter;
83 83
84 void setCategoryDefaults(); 84 void setCategoryDefaults();
85 QFont mDetailsFont;
85 86
86 private: 87 private:
87 KABPrefs(); 88 KABPrefs();
88 89
89 static KABPrefs *sInstance; 90 static KABPrefs *sInstance;
90}; 91};
91 92
92#endif 93#endif
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index e970c3d..c8b68c7 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -77,48 +77,61 @@ class ExtensionItem : public QCheckListItem
77#ifndef KAB_EMBEDDED 77#ifndef KAB_EMBEDDED
78 KService::Ptr mPtr; 78 KService::Ptr mPtr;
79#else //KAB_EMBEDDED 79#else //KAB_EMBEDDED
80 ExtensionFactory* mFactory; 80 ExtensionFactory* mFactory;
81 QString mName; 81 QString mName;
82 QString mComment; 82 QString mComment;
83 83
84#endif //KAB_EMBEDDED 84#endif //KAB_EMBEDDED
85 85
86}; 86};
87 87
88KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) 88KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name )
89 : KPrefsWidget( prefs, parent, name ) 89 : KPrefsWidget( prefs, parent, name )
90{ 90{
91 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 91 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
92 KDialog::spacingHint() ); 92 KDialog::spacingHint() );
93 93
94 QTabWidget *tabWidget = new QTabWidget( this ); 94 QTabWidget *tabWidget = new QTabWidget( this );
95 topLayout->addWidget( tabWidget ); 95 topLayout->addWidget( tabWidget );
96 96
97 // General page 97 // General page
98 QWidget *generalPage = new QWidget( this ); 98 QWidget *generalPage = new QWidget( this );
99 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), 99 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
100 KDialog::spacingHintSmall() ); 100 KDialog::spacingHintSmall() );
101
102 QWidget *hBox = new QWidget( generalPage, "qhbox" );
103 QHBoxLayout *hboxLayout = new QHBoxLayout( hBox);
104 KPrefsWidFont *detailsFont =
105 addWidFont(i18n("phone:123"),i18n("Details view font"),
106 &(KABPrefs::instance()->mDetailsFont),hBox);
107 hboxLayout->addWidget(detailsFont->label());
108 hboxLayout->addWidget(detailsFont->preview());
109 hboxLayout->addWidget(detailsFont->button());
110 hboxLayout->setMargin(KDialog::marginHintSmall() );
111 hboxLayout->setSpacing(KDialog::spacingHintSmall());
112 layout->addWidget( hBox );
113
101 //general groupbox 114 //general groupbox
102 QVBox *vBox = new QVBox( generalPage, "qvbox" ); 115 QVBox *vBox = new QVBox( generalPage, "qvbox" );
103 QVBoxLayout *boxLayout = new QVBoxLayout( vBox->layout(), -1, "qvboxlayout" ); 116 QVBoxLayout *boxLayout = new QVBoxLayout( vBox->layout(), -1, "qvboxlayout" );
104 boxLayout->setAlignment( Qt::AlignTop ); 117 boxLayout->setAlignment( Qt::AlignTop );
105 boxLayout->setMargin(KDialog::marginHintSmall() ); 118 boxLayout->setMargin(KDialog::marginHintSmall() );
106 vBox->layout()->setMargin(KDialog::marginHintSmall()) ; 119 vBox->layout()->setMargin(KDialog::marginHintSmall()) ;
107 vBox->layout()->setSpacing(KDialog::spacingHintSmall()); 120 vBox->layout()->setSpacing(KDialog::spacingHintSmall());
108 boxLayout->setSpacing( KDialog::spacingHintSmall() ); 121 boxLayout->setSpacing( KDialog::spacingHintSmall() );
109 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); 122 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" );
110 boxLayout->addWidget( mSearchReturnBox ); 123 boxLayout->addWidget( mSearchReturnBox );
111 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); 124 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" );
112 boxLayout->addWidget( mViewsSingleClickBox ); 125 boxLayout->addWidget( mViewsSingleClickBox );
113 126
114 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); 127 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" );
115 boxLayout->addWidget( mNameParsing ); 128 boxLayout->addWidget( mNameParsing );
116 129
117 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); 130 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" );
118 boxLayout->addWidget( mMultipleViewsAtOnce ); 131 boxLayout->addWidget( mMultipleViewsAtOnce );
119 132
120 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); 133 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" );
121 boxLayout->addWidget( mAskForQuit ); 134 boxLayout->addWidget( mAskForQuit );
122 135
123 layout->addWidget( vBox ); 136 layout->addWidget( vBox );
124 137