-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 53 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.h | 6 |
2 files changed, 57 insertions, 2 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 5a8038b..b7b35bc 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -213,8 +213,52 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
213 | mbList->insertItem( tr("View"), catMenu ); | 213 | mbList->insertItem( tr("View"), catMenu ); |
214 | setCentralWidget( abList ); | 214 | setCentralWidget( abList ); |
215 | 215 | ||
216 | fontMenu = new QPopupMenu(this); | ||
217 | fontMenu->setCheckable( true ); | ||
218 | connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); | ||
219 | |||
220 | fontMenu->insertItem("Small", 0); | ||
221 | fontMenu->insertItem("Normal", 1); | ||
222 | fontMenu->insertItem("Large", 2); | ||
223 | |||
224 | defaultFont = new QFont( abList->font() ); | ||
225 | |||
226 | slotSetFont(startFontSize); | ||
227 | |||
228 | mbList->insertItem( tr("Font"), fontMenu); | ||
229 | setCentralWidget(abList); | ||
230 | |||
216 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 231 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
217 | } | 232 | } |
233 | void AddressbookWindow::slotSetFont( int size ) { | ||
234 | |||
235 | if (size > 2 || size < 0) | ||
236 | size = 1; | ||
237 | |||
238 | startFontSize = size; | ||
239 | |||
240 | switch (size) { | ||
241 | case 0: | ||
242 | fontMenu->setItemChecked(0, true); | ||
243 | fontMenu->setItemChecked(1, false); | ||
244 | fontMenu->setItemChecked(2, false); | ||
245 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); | ||
246 | break; | ||
247 | case 1: | ||
248 | fontMenu->setItemChecked(0, false); | ||
249 | fontMenu->setItemChecked(1, true); | ||
250 | fontMenu->setItemChecked(2, false); | ||
251 | abList->setFont( *defaultFont ); | ||
252 | break; | ||
253 | case 2: | ||
254 | fontMenu->setItemChecked(0, false); | ||
255 | fontMenu->setItemChecked(1, false); | ||
256 | fontMenu->setItemChecked(2, true); | ||
257 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); | ||
258 | break; | ||
259 | } | ||
260 | } | ||
261 | |||
218 | 262 | ||
219 | void AddressbookWindow::setDocument( const QString &filename ) | 263 | void AddressbookWindow::setDocument( const QString &filename ) |
220 | { | 264 | { |
@@ -244,6 +288,9 @@ void AddressbookWindow::resizeEvent( QResizeEvent *e ) | |||
244 | 288 | ||
245 | AddressbookWindow::~AddressbookWindow() | 289 | AddressbookWindow::~AddressbookWindow() |
246 | { | 290 | { |
291 | Config cfg("AddressBook"); | ||
292 | cfg.setGroup("Font"); | ||
293 | cfg.writeEntry("fontSize", startFontSize); | ||
247 | } | 294 | } |
248 | 295 | ||
249 | void AddressbookWindow::slotUpdateToolbar() | 296 | void AddressbookWindow::slotUpdateToolbar() |
@@ -713,6 +760,8 @@ void AddressbookWindow::initFields() | |||
713 | cfg.setGroup( "Version" ); | 760 | cfg.setGroup( "Version" ); |
714 | version = cfg.readNumEntry( "version" ); | 761 | version = cfg.readNumEntry( "version" ); |
715 | i = 0; | 762 | i = 0; |
763 | startFontSize = 1; | ||
764 | |||
716 | if ( version >= ADDRESSVERSION ) { | 765 | if ( version >= ADDRESSVERSION ) { |
717 | 766 | ||
718 | cfg.setGroup( "ImportantCategory" ); | 767 | cfg.setGroup( "ImportantCategory" ); |
@@ -726,6 +775,10 @@ void AddressbookWindow::initFields() | |||
726 | slOrderedFields.append( zn ); | 775 | slOrderedFields.append( zn ); |
727 | zn = cfg.readEntry( "Category" + QString::number(++i), QString::null ); | 776 | zn = cfg.readEntry( "Category" + QString::number(++i), QString::null ); |
728 | } | 777 | } |
778 | cfg.setGroup( "Font" ); | ||
779 | startFontSize = cfg.readNumEntry( "fontSize", 1 ); | ||
780 | |||
781 | |||
729 | } else { | 782 | } else { |
730 | QString str; | 783 | QString str; |
731 | str = getenv("HOME"); | 784 | str = getenv("HOME"); |
diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h index 342077f..e2a7100 100644 --- a/core/pim/addressbook/addressbook.h +++ b/core/pim/addressbook/addressbook.h | |||
@@ -70,13 +70,13 @@ private slots: | |||
70 | void slotFind(); | 70 | void slotFind(); |
71 | void slotSetCategory( int ); | 71 | void slotSetCategory( int ); |
72 | void slotUpdateToolbar(); | 72 | void slotUpdateToolbar(); |
73 | 73 | void slotSetFont(int); | |
74 | private: | 74 | private: |
75 | void initFields();// inititialize our fields... | 75 | void initFields();// inititialize our fields... |
76 | AbLabel *abView(); | 76 | AbLabel *abView(); |
77 | void populateCategories(); | 77 | void populateCategories(); |
78 | 78 | ||
79 | QPopupMenu *catMenu; | 79 | QPopupMenu *catMenu, *fontMenu; |
80 | QPEToolBar *listTools; | 80 | QPEToolBar *listTools; |
81 | QToolButton *deleteButton; | 81 | QToolButton *deleteButton; |
82 | QValueList<int> allFields, | 82 | QValueList<int> allFields, |
@@ -94,6 +94,8 @@ private: | |||
94 | int viewMargin; | 94 | int viewMargin; |
95 | 95 | ||
96 | bool syncing; | 96 | bool syncing; |
97 | QFont *defaultFont; | ||
98 | int startFontSize; | ||
97 | }; | 99 | }; |
98 | 100 | ||
99 | #endif | 101 | #endif |